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

Re: Dynamic DOCTYPE inclusion applying XSLT on doc hie

Subject: Re: Dynamic DOCTYPE inclusion applying XSLT on doc hierarchy
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 5 Jun 2002 11:12:38 -0600 (MDT)
xslt doctype input
Yves Forkl wrote:
> I have a set of XML files organized in a book-chapter-section document
> hierarchy. Each file is processed individually (but may include
> another one of these files) using the same XSLT stylesheet to produce a
> separate output file for each input file, running Xalan-J.
> 
> Consequently, I need to dynamically include the top-level file's
> DOCTYPE declaration when processing each input file, as I'm defining
> the entities required for file inclusion in the internal DTD subset.
> (Besides that, my stylesheet seems to make Xalan-J require a DOCTYPE
> declaration.)

DOCTYPE declarations are not in the XPath/XSLT tree model
(see the XPath spec). They are information for the XML parser
only. The application doesn't need to know about them, so
you don't have access to them.

> I tried using the document() function inside the template that is
> reading the input file's document element node, in order to include an
> extra input file that only contained that DOCTYPE declaration and
> entity definitions:
> 
> <xsl:apply-templates
> select="document('toplevel-file-doctype_and_entities.xml')"/>
> 
> The problem, however, is that this makes XSLT processing start again
> with the XSLT document root node ("/"), leading to an infinite loop.

That shouldn't have happened. Processing should have aborted because
the XML was not well-formed. (You can't declare a DOCTYPE and then 
not have a document element). Apparently when this error was encountered,
your XSLT processor kept on going as if you had done document(''), which
means to use the stylesheet as the argument.

> Is there a way to read a DOCTYPE declaration from an extra input file
> without moving back to the top of the source tree?

There's no way to read a DOCTYPE from within XSLT.


   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 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-2011 All Rights Reserved.