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

Passing an XML document fragment ot a stylesheet

Subject: Passing an XML document fragment ot a stylesheet
From: "Martin Sevigny" <sevigny@xxxxxxxxx>
Date: Wed, 15 Mar 2000 10:53:52 +0100
xml document fragment
Hi,

I'm looking for advices on the best method to pass an XML document fragment to a stylesheet that will process this fragment at one place in the overall processing. All this is done in a servlet environment, I'm currently using Saxon but if I can avoid extensions and be processor independant it would be great.

Here is what I mean. I have a rather static and long document being processed by an XSLT stylesheet. Some short info is passed to the stylesheet as global parameters, and this works fine.

The problem is that at some point in the processing, I need to include external information, dynamically created, which is too complex to actually pass it as a string. This information could be something like:

<docList>
<doc linked="yes" code="d1">Any title</doc>
<doc code="d2">Any title again</doc>
...
</docList>

This information is known before the start of XSLT processing.

Once I get this document fragment, I would like to apply templates to it, for instance to output an HTML list with links.

One way to see the problem is to say that the XML document being processed is modified before processing, having the above docList element (for instance) and its content included at some place. 

I can see different ways to do this:

1) Pass a node-set parameter to the stylesheet

Is it possible? If so, how do I create one using Saxon? Or other tools?

2) Pass a result tree fragment to the stylesheet, and convert it to a node-set with the node-set() extension

This method needs an extension, although a common one. But again, how do I generate the RTF with Saxon or other tools?

3) Use the document() function to load this document fragment

I could write the document fragment to a file, but I'm afraid of synchronization problems. Or I could use an URL pointing to my servlet, which would return an XML document containing this fragment, but this solution implies that the servlet calls the XSLT processor which calls back the servlet, which doesn't seem to be optimal.

4) Use an extension element (Saxon)

I can create an extension element in Saxon, and I've done it, but I have three problems with this approach: the class doesn't know about the servlet environment; it needs extension; and I still have the problem or returning a result tree fragment instead of a node-set, so my class needs to do the formatting or I need the node-set() function.


May be I'm missing some other solutions. I prefer solution 1 in theory, but I don't know if it is really feasible and if so how it can be done. I could use solution 3 with a call to the servlet, but isn't that too much overhead?

Thank's for any opinions, solutions, advices, tips, etc.

Have a good day,

Martin Sevigny
sevigny@xxxxxxxxx


 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.