Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] String literals with both single and double quotes

From: Abel Braaksma <abel.online@--------->
To:
Date: 1/4/2007 11:32:00 AM
Andrew Welch wrote:

So does that mean in XPath 2.0 they can?

Yes. You can escape a single quote (apostrophe) or a double quote by 
doubling it, depending on the containing quotes. I.e., if your string is 
contained in single quotes, you can double a single quote to escape it. 
In a value-of select expression, it looks like this. where the single 
quote is escaped:



<xsl:value-of select=" ' dquote: &quot; and squote: '' ' " />



This selects the following:



dquote: " and squote: '



In XSLT literal attributes this is -- of course -- not possible due to 
restrictions of XML:



<xsl:output-character character="1" string=" "" "/>



but here escaping isn't needed at all (but this is not XPath, but XSLT):



<xsl:output-character character="1" string=" &quot; "/>



Cheers,
-- Abel
  http://www.nuntia.nl


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent