xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From caporale <trancer...@hotmail.com>
Subject Re: [Announce] Escaping double quotation marks in XSL
Date Wed, 24 Oct 2007 02:20:04 GMT

<xsl:template match="image">
&lt;img&gt;
<xsl:attribute name="src">
<xsl:apply-templates />
</xsl:attribute>
</img>
</xsl:template>

This XSL gives me something like &lt;img src="picture.jpg"/&gt;, which
doesn't work, because the quotation marks aren't escaped.  It's inside
Javascript, so it has to be &lt;img src=\"picture.jpg\"/&gt;

Replacing it with "&quot;" doesn't work for some reason, and I can't put a
backslash in that template without getting an error.



Glen Mazza wrote:
> 
> What do you mean by "escape"? Using a backslash as you have below, or 
> replacing it with the macro "&quot;"?
> I think you want the latter--and if you do that, it should work just as 
> nicely as the &lt; and &gt; are doing for you right now.
> 
> HTH,
> Glen
> 
> caporale schrieb:
>> I have XSL inside Javascript.  The XML looks like this:
>> <image>imagename.jpg</image>.  Any time that tag's there, the output
>> should
>> be &lt;img src=\"imagename.jpg\" / &gt;.  This template works, but it
>> doesn't escape the quotation marks:
>>
>> <xsl:template match="image">
>> &lt;img&gt;
>> <xsl:attribute name="src">
>> <xsl:apply-templates />
>> </xsl:attribute>
>> </img>
>> </xsl:template>
>>
>> What do I need to do to escape the quotation marks from that?  I've seen
>> about 400 examples on-line--none of which actually do what I want.
>>
>> Thanks,
>> Joseph Caporale
>>
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Escaping-double-quotation-marks-in-XSL-tf4680435.html#a13377638
Sent from the Apache XML - General mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message