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

Re: Unparsed entities (was RE: Special entity characters in

Subject: Re: Unparsed entities (was RE: Special entity characters in Shift-JIS XSL).
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 20 Dec 1999 11:29:34 GMT
special entities
> can I specify a DOCTYPE in my stylesheet?
yes

<!DOCTYPE xsl:stylesheet [
<!ENTITY API  "this" >
]>

....

    <xsl:template match="/index">
    <general>
        <title>&API; Index</title>

but then &API; will be expanded by the xml parser as it parses the
stylesheet so the xsl engine will see  
<title>this Index</title>
In which case there may or may not be any point in having the entity,
you could have just written "this index" in place.

You can probably more usefully share the dtd with your original
document, if that alrady has a definition of the entity:

<!DOCTYPE xsl:stylesheet SYSTEM "..\..\docs\dtds\general.dtd" >

This only works if your xsl system uses a non validating parser that
does read external entities. (They are not required to be read according
to the xml spec.)

Note that both of these solutions put `this' into your output.
If you really want `&API' then you don't need a doctype in your
stylesheet at all just use
  <title>
  <xsl:text disable-output-escaping="yes">&amp;API; Index<xsl:text>
  </title>

Note however this last solution only works if you know the output tree
is going to be linearised into a file and then reparsed as XML.
If instead the result tree is being stuffed straight to a renderer or
other XML application as an XML tree, then the receiver will get
the characters & A P I ; not an entity reference.

David


 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.