#18 &lt; to < conversion.

closed
nobody
None
5
2005-12-15
2005-10-13
Anonymous
No

in version 0.48:
if you have a '&gt;' within a javascript string,
xml::xslt converts it to a '>' but it does not convert
a '&lt;' to a '<'.

example:

-------------xml.pl-------------------
#!/usr/bin/perl

use XML::XSLT;

#create xml:
$xml = "<tag>something</tag>";

#transform and send html:
my $xsl = new XML::XSLT("xsl.xsl", warnings => 1);
$xsl->transform($xml);
print $xsl->toString();
$xsl->dispose();
die;

---------------------xsl.xsl-------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

<html>

<script language="javascript">
var moe = new String('&lt; lalala &gt;');
alert(moe);
</script>

<body>
hello.
</body>
</html>

</xsl:template>
</xsl:stylesheet>

contact: pinkmonkeyboy@hotmail.com

Discussion

  • Jonathan Stowe
    Jonathan Stowe
    2005-12-15

    • status: open --> closed
     
  • Jonathan Stowe
    Jonathan Stowe
    2005-12-15

    Logged In: YES
    user_id=313586

    This is correct, but the behaviour is not something that
    XML::XSLT is doing - it is the underlying XML::Parser - the
    &lt; needs to be entity encoded for it to be valid XML

    /J\