M
Matthew Simoneau
I'm trying to figure out how to HTML encode shift_jis text and put it into
an attribute.
Starting with this XML-file with characters encoded in shift_jis
<?xml version="1.0" encoding="shift_jis"?>
<test>
<label>??</label>
</test>
and applying this stylesheet
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>
<xsl:template match="test">
<html>
<body>
<xsl:value-of select="label"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
creates output that looks like this:
<html>
<body>数学</body>
</html>
Notice how the shift_jis characters have been HTML escaped (or encoded?) and
display fine in the browser. So far so good. But now I want to put these
escaped characters into an attribute. Here is the HTML I'd really like to
make:
<html>
<body><a href="matlab:disp('数学')">foo</a></body>
</html>
Notice that the same two encoded Japanese characters are now within an
attribute and surrounded by some other text. I've tried every trick I know
and searched all over the Internet, but haven't been able to figure this one
out.
Can someone please point me in the right direction? Thanks for your help!
an attribute.
Starting with this XML-file with characters encoded in shift_jis
<?xml version="1.0" encoding="shift_jis"?>
<test>
<label>??</label>
</test>
and applying this stylesheet
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>
<xsl:template match="test">
<html>
<body>
<xsl:value-of select="label"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
creates output that looks like this:
<html>
<body>数学</body>
</html>
Notice how the shift_jis characters have been HTML escaped (or encoded?) and
display fine in the browser. So far so good. But now I want to put these
escaped characters into an attribute. Here is the HTML I'd really like to
make:
<html>
<body><a href="matlab:disp('数学')">foo</a></body>
</html>
Notice that the same two encoded Japanese characters are now within an
attribute and surrounded by some other text. I've tried every trick I know
and searched all over the Internet, but haven't been able to figure this one
out.
Can someone please point me in the right direction? Thanks for your help!