[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
> 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">&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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|