RE: How to escape character when using style sheet parameter in J ava

Subject: RE: How to escape character when using style sheet parameter in J ava
From: Hien Luu <Hien@xxxxxxxxxxx>
Date: Fri, 26 May 2000 09:56:56 -0700
I was trying output the DOCTYPE to the output tree.  The doctype-system
attribute of the
xsl:output provides this functionality.

Thanks for taking your time to reply to my question.


-----Original Message-----
From: Mike Brown [mailto:mike@xxxxxxxx]
Sent: Thursday, May 25, 2000 10:34 PM
To: xsl-list@xxxxxxxxxxxxxxxx
Subject: Re: How to escape character when using style sheet parameter in

> 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

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:

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread