[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Need to remove unusual character in source

Subject: Re: Need to remove unusual character in source
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 27 Sep 2006 01:16:44 +0200
xsl remove a character
Mario Madunic wrote:
I've come across a character in the source that I need to remove.

I'm using Saxon 8, XSLT 2

the character is and its a control character

0x18 CAN


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
|

||

|

|

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.