Hi, I am getting some node properties which have an "&" character, and the XSLT is converting them to HTML entities by default. Is there any way I can avoid this behaviour?
This is how you create a CDATA Section in XML output... depending on what's in the video element in the first place, you might go for another solution, which is to just copy the video element from the source to the output:
<xsl:copy-of select="video" />
Which will copy the entire <video> element (so don't put <video> tags around it).
But that's really another problem - ampersands in URLs (and thus, file references) must be URLEncoded - so that URL will never work, unless encoded like this:
/media/1959/j%26b phoenician gotas silueta.jpg (and even the spaces ought to be output as %20 too)
So you should really look at the umbraco.library:URLEncode() extension method for this (that is if you can't persuade the editors not to use ampersands in filenames :-)
HTML Entities in XSLT
Hi, I am getting some node properties which have an "&" character, and the XSLT is converting them to HTML entities by default. Is there any way I can avoid this behaviour?
A fragment from the code:
Hi manuelpedrera,
To have the processor output video elements as CDATA, you need to set an attribute on the <xsl:output /> element:
<xsl:output cdata-section-elements="video" /> ... <video> <xsl:value-of select="video" disable-output-escaping="yes" /> </video>
This is how you create a CDATA Section in XML output... depending on what's in the video element in the first place, you might go for another solution, which is to just copy the video element from the source to the output:
Which will copy the entire <video> element (so don't put <video> tags around it).
/Chriztian
Hi Christian, thank you very much for your reply.
However, what I'm asking for is a way to avoid this situation. What I'm getting now is:
And what I want is (changing the "&" for an "&"):
Why? Because the front-end is a flash movie and it's trying to load the videos & images with html entities, which obviously doesn't work.
By the way, thanks for that CDATA trick ;)
Hi again,
I thought so :-)
But that's really another problem - ampersands in URLs (and thus, file references) must be URLEncoded - so that URL will never work, unless encoded like this:
/media/1959/j%26b phoenician gotas silueta.jpg (and even the spaces ought to be output as %20 too)
So you should really look at the umbraco.library:URLEncode() extension method for this (that is if you can't persuade the editors not to use ampersands in filenames :-)
/Chriztian
Thank you Chriztian ;)
I added the
to the xsl:value-of sentence and it worked too.
is working on a reply...