replace <br> with <br/ > in XSLT 2.0 -
the question asked many times, not find help.
i replace
<br>
to
<br />
in nodes.
xml
<paragraphs> <paragraph><![cdata[lorem ipsum dolor sit amet, consetetur sadipscing elitr.<br>sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.<br>sed diam voluptua.<br>at vero eos et accusam et justo duo dolores et ea rebum.]]> </paragraph> <paragraphs>
xsl
<xsl:template match="paragraph"> <paragraph> <xsl:attribute name="type">public</xsl:attribute> <xsl:value-of select="replace(., '\<br\>', '\<br /\>')"/> </paragraph> </xsl:template>
unfortunately saxon quits with
sxxp0003: error reported xml parser: value of attribute "select" associated element type "null" must not contain '<' character. org.xml.sax.saxparseexception: value of attribute "select" associated element type "null" must not contain '<' character.
i tried escaping "\" nevertheless can''t right.
any ideas?
try way:
<xsl:template match="paragraph"> <paragraph type="public"> <xsl:value-of select="replace(., '<br>', '<br/>')"/> </paragraph> </xsl:template>
Comments
Post a Comment