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

Re: How to escape character when using style sheet parameter

Subject: Re: How to escape character when using style sheet parameter in Java
From: Mike Brown <mike@xxxxxxxx>
Date: Thu, 25 May 2000 23:34:02 -0600 (MDT)
xsl escape character
> I trying to use a Java program to perform the transformation and using the
> style sheet parameter to feed in a string into the style sheet from a 
> Java program.  The problem that I encountered is that if a string
> contains XML reserved characters like "<" or ">", the output of the
> transformation translates the "<" into "&lt;"

I do not believe the escaping of markup characters in your output is
related to the fact that you are passing a string as a parameter to the
stylesheet.

Read the section of the XSLT 1.0 spec that deals with output, and you will
see that the default output method is "xml", to produce a well-formed XML
document from the result tree. A well-formed XML document cannot contain
markup delimiters that are not being used to delimit markup, for reasons
that should be obvious. If using the "html" output method, the same
guideline applies. Therefore, when the characters "<" ">" "&" and
sometimes """ or "'" appear in what would be character data sections of
the document, they are escaped.

If you are trying to output XML or HTML, then why do you want to produce
documents that may not be well-formed, with "<" "&" and other markup
characters being treated like ordinary characters, thus making the
document unreadable because there's no way to tell what is markup and
what is not?

However, it was known that there may be some rare occasions when it may be
necessary to disable the escaping of markup characters, so the creators of
the XSLT spec bestowed upon us the disable-output-escaping attribute for
certain situations. Search for this in the spec and you will see how to go
about creating text nodes that, when serialized, will not have their
character data subjected to the usual escape treatment. The caveat is that
using this functionality makes it possible to write broken documents. I
wish the spec used stronger language to discourage its use.

   - Mike
___________________________________________________________
Mike J. Brown, software engineer, Webb Interactive Services
XML/XSL stuff: http://www.skew.org/    http://www.webb.net/


 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.