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

RE: translate function & hex data

Subject: RE: translate function & hex data
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Mon, 28 Feb 2000 14:41:17 -0700
hexadecimal data
Paul Bell wrote:
> Is it possible to specify a hexadecimal value (00-ff)
> as the third argument to the translate function?
> My larger goal is to translate backslashes that would
> appear in a Windows filesystem path to a given byte value.

Well, you can't refer to bytes, per se, because XPath and XSLT functions
operate on the data model prescribed in the XPath spec. This model does not
deal with bytes; it deals with nodes, and (following the reference to the
XML Infoset spec) at a lower level, with Unicode/UCS characters, regardless
of how they are represented when serialized as a byte stream.

Since an XML parser will resolve character references before the stylesheet
tree is built, you should be able to put any Unicode characters in the
arguments to the translate() function. For example,
translate($someString,'abcde','ABCD&#x45;') is the same as
($someString,'abcde','ABCDE').

If your goal is to output bytes that represent characters from the Windows
CP-1252 (or whatever) character set, you'll need to determine what the
proper Unicode/UCS code points are for those characters, and then rely on
your serialization mechanism to encode the characters as the bytes you want.
It may take some experimentation depending on your particular situation.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.