mlse
07-20-2006, 03:50 PM
Hi,
What I'm trying to do is best described using some examples.
I want to convert this:
<myelem>Line 1\nLine 2\nLine 3</myelem>
To this:
<div>Line 1<br />Line 2<br />Line 3</div>
I've tried this:
<xsl:template match="myelem">
<div>
<xsl:value-of select="translate(., '\n', '<br />')" />
</div>
</xsl:template>
But I get the error:
The character '<' cannot be used in an attribute value. Error processing resource 'http://localhost/test.xml'...
<xsl:value-of select="translate(., '\n', '<br />')" />
------------------------------------------^
So perhaps the parser thinks I'm trying to make the substitution in one of the attributes of <myelem> ... which is not what I want!
I am pretty (actually very!) new to XSLT, so please bear with me while I'm still learning ...
Any help much appreciated!
Mike.
What I'm trying to do is best described using some examples.
I want to convert this:
<myelem>Line 1\nLine 2\nLine 3</myelem>
To this:
<div>Line 1<br />Line 2<br />Line 3</div>
I've tried this:
<xsl:template match="myelem">
<div>
<xsl:value-of select="translate(., '\n', '<br />')" />
</div>
</xsl:template>
But I get the error:
The character '<' cannot be used in an attribute value. Error processing resource 'http://localhost/test.xml'...
<xsl:value-of select="translate(., '\n', '<br />')" />
------------------------------------------^
So perhaps the parser thinks I'm trying to make the substitution in one of the attributes of <myelem> ... which is not what I want!
I am pretty (actually very!) new to XSLT, so please bear with me while I'm still learning ...
Any help much appreciated!
Mike.