Reputation: 5
I have some questions with XSL.
XSLT 2.0
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="main" match="/">
<xsl:for-each select="collection('file:///C:/Users/Quality/Documents/ProyectoComerciales/download_files/?select=*.txt;unparsed=yes')">
<xsl:variable name="file" select="tokenize(document-uri(.), '/')[last()]"/>
<xsl:variable name="name" select="substring-before($file,'.')"/>
<xsl:variable name="url" select="concat('file:///C:/Users/Quality/Documents/ProyectoComerciales/xml/',$name,'.xml')"/>
<xsl:result-document method="xml" indent="yes" href="{$url}">
<xsl:variable name="path" select="concat('file:///C:/Users/Quality/Documents/ProyectoComerciales/download_files/',$file)"/>
<xsl:variable name="text" select="tokenize(unparsed-text($path),'
')"/>
<download>
...
</download>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
But is possible to know when the transformation finished correctly?
Upvotes: 0
Views: 135
Reputation: 163322
(1) If you look at the API for calling Saxon from Java (either the JAXP API or the s9api API) you will see that all the relevant methods have exceptions defined. If the transformation fails, one of these exceptions will be thrown. You can also get more detailed information about the errors by nominating an ErrorListener to receive notification of errors as they occur.
(2) Getting the transformation result into a database is the responsibility of your Java code. If you want the secondary result documents (that is, the output of xsl:result-document) to go into a database, Saxon allows you to nominate an OutputURIResolver which will be called when each result document is available.
Upvotes: 1