[Home] [By Thread] [By Date] [Recent Entries]
Mario Madunic wrote:
I've come across a character in the source that I need to remove. Perhaps there's another option, if you are really stuck to this ill-formed data. You use Saxon, so you might want to use its extensions. <xsl:function name="try-loading-file"> <xsl:param name="filename" /> <xsl:value-of select="document($filename)" /> </xsl:function> |<xsl:template match="/">
<root>
<xsl:copy-of
select="saxon:try(yourns:try-loading-file('your filename here'),
saxon:function('yourns:catch-loading-error',1))"/>
</root>
</xsl:template>||<xsl:function name="yourns:catch-loading-error">| ||| <xsl:param name="error-info"/>
<xsl:sequence select="$error-info"/>
<!-- DO SOMETHING WITH THE ERROR, LIKE
CALLING YOUR OWN EXTENSION FUNCTION
which may take the document, filter it and
let the application do a retry -->
||</xsl:function>||| |This information comes largely from Saxon's documentation: http://www.saxonica.com/documentation/extensions/functions/try.html| || |Consider this a non-trivial and definitely an unorthodox method. Also, your own extension function, written in Java for example, will have to create side-effects, which may yield strange results. I don't think this is the right path to take, but if you really have to do something with this data and if you absolutely have no other option, this might be a viable solution. | |Cheers, Abel Braaksma http://abelleba.metacarpus.com | || | |
|

Cart



