Re: [xsl] using xsl:output-character to render characters in 2 ways

Subject: Re: [xsl] using xsl:output-character to render characters in 2 ways
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 12 Nov 2009 12:59:43 GMT
> Is it wrong to escape characters such as this in when its not an
> attribute value? It will involve more work to cancel out the escaping.

no or yes, depending.

If you have a ' in a comment or cdata section or processing instruction
 and quote it for example it is wrong because the xml parser won't
 unquote it.

<p> it's</p>

is the same as 

<p> it&#39;s</p>

but

<?xml-stylesheet href='foo.xsl'?>

isn't the same as


<?xml-stylesheet href=&#39;foo.xsl&#39;?>


 but the implied question was how come the system isn't just doing the
necessary quoting for you, you must be suppressing its usual
serialisation somewhere and writing attribute syntax "by hand"?

> If my way is as good as any, the only way I can get this to work is by
> declaring the single-quote entity in a Doctype declaration for every
> stylesheet its used in:

given that it's easier and less keystrokes to type &#xE503; as
&single-quote; why bother with the entity at all, and just use  &#xE503;
It makes no difference to the XSLT processor, it won't see either
&single-quote; or &#xE503; both are expanded by teh xml parser before it
starts to look at the xslt code.

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread