[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

encoding shift_jis into an attribute

Subject: encoding shift_jis into an attribute
From: "Matthew Simoneau" <Matthew.Simoneau@xxxxxxxxxxxxx>
Date: Wed, 2 Jun 2004 16:37:44 -0400
shift_jis
Hi everyone,

I'm trying to figure out how to HTML encode shift_jis text and put it
into an attribute.

I start with this XML-file with characters encoded in shift_jis:


<?xml version="1.0" encoding="shift_jis"?>
<test>
  <label>??</label>
</test>


?? are two Japanese characters in the file, but I wanted to send this
out as ASCII for maximum legibility.

When I apply this simple 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">
  <xsl:output method="html"/>

<xsl:template match="test">
  <html>
    <body>
      <xsl:value-of select="label"/>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>


it creates output that looks like this:


<html>
   <body>&#25968;&#23398;</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('&#25968;&#23398;')">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.  Whenever I try to put it into an attribute (using
<xsl:attribute> or something), I get "%E6%95%B0%E5%AD%A6" (which I don't
even understand), not "&#25968;&#23398;" (which is what I want).

Can someone please point me in the right direction?  Thanks for your
help!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.