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

Changing text "in place"

Subject: Changing text "in place"
From: Michel Goossens <Michel.Goossens@xxxxxxx>
Date: Sat, 1 May 1999 19:21:23 +0200 (METDST)
changing text nodes
I am presently working on writing an XSL stylesheet translating an XML
document (the XML spec, in fact) into LaTeX. However, I have a problem
to get some characters that are "special" for LaTeX into a form that is
acceptable (e.g., $, %, #, &, etc. have a special meaning). So the easiest
would be to escape such characters when they get transferred to the result
tree, _if necessary_. The latter is important, since inside verbatim-like
environments the characters can be used as-is, so I have to handle the 
text nodes depending on their parents. Before I go off and write a set
of Java routines using xt's extension mechanism, I wonder wether something 
simpler is possible. As an example, consider the following extract from
the XML spec:

<scrap>
....
<prod id="NT-PubidLiteral"><lhs>PubidLiteral</lhs>
<rhs>'"' <nt def='NT-PubidChar'>PubidChar</nt>* 
'"' 
| "'" (<nt def='NT-PubidChar'>PubidChar</nt> - "'")* "'"</rhs>
</prod>
<prod id="NT-PubidChar"><lhs>PubidChar</lhs>
<rhs>#x20 | #xD | #xA 
|&nbsp;[a-zA-Z0-9]
|&nbsp;[-'()+,./:=?;!*#@$_%]</rhs>
</prod>
</scrap>

Inside a scrap element (but not inside, for instance, an eg element)
I would like to escape #, $, %, _, amongst others, by preceding them
with a \ escape character. I have tried to see how to use the translate
function on a text node, but that maps only characters one-to-one. 
Also, I have not found how to stream the content of the input (source)
tree text note through a "filter" to the output (result) tree text node.
Any help would be appreciated. m

----------------------------------------------------
Dr. Michel Goossens         Phone: (+41 22) 767-5028
IT Division                 Fax:   (+41 22) 767-8630
CERN                        Email:  goossens@xxxxxxx
CH-1211 Geneva 23    F-01631 CERN Cedex
Switzerland          France




 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.