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

RE: XSLT and XInclude?

Subject: RE: XSLT and XInclude?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 23 Mar 2009 11:18:48 -0000
RE:  XSLT and XInclude?
> I've come across some documents that are using XInclude to 
> fragment a larger tech manual. I've got the basic stylesheet 
> working that reads the document name from the href and then 
> opens it with the doc() function.

Are you sure you need to handle this in the XSLT stylesheet? Many XML
parsers have built-in support for XInclude if you set the right options.
Short of this, there are free-standing XInclude processors, including some
written in XSLT. I think it would be better to do XInclude processing as a
separate step from transformation.
> 
> In this particular case, I'm able to process the content 
> properly as the included document has a regular structure 
> that I can process directly. I got to thinking though that I 
> might need to process these included files within the context 
> of their use/placement in the referencing document.
> 
> I would like to somehow pass the context in the parent 
> document to the doc function and possibly the current 
> template mode. 

What would the doc() function do with this information? Surely you want to
pass these details to the templates that are processing the included
document, which you can do using the normal XSLT parameter passing
mechanisms.

> One area I defiantly got into trouble with my current success 
> is in regards to the namespace definitions. These included 
> documents have no use outside the parent document; so I guess 
> this error hasn't been found because the individual file was 
> not edited without the parent. 
> Anyway, there was some change tracking markup added via some 
> add/delete elements in a different namespace. Within the 
> parent the namespace was defined, but the included file 
> didn't have the declaration. When this file was passed to the 
> doc function it errored out because the namespace wasn't 
> defined in the included file.
> 
> I fixed this problem by correcting the included file, but if 
> I could have passed the context (in this case the namespace 
> information) I wouldn't have had a problem.

Documents included using XInclude have to be namespace well-formed in their
own right. If they aren't, then expect the tools to give you errors.

Michael Kay
http://www.saxonica.com/

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.