This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: how to transform one doc to 2 docs at the same time?
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: Jakub dot Valenta at Deio dot net
- Cc: XSL-List at lists dot mulberrytech dot com
- Date: Thu, 14 Feb 2002 09:01:01 +0000
- Subject: Re: [xsl] how to transform one doc to 2 docs at the same time?
- Organization: Jeni Tennison Consulting Ltd
- References: <OFF975ED0B.92DFC3D2-ONC2256B5F.00573642@e-know.net>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Jakub,
> you accept one xml message and want to conver it to more then one
> and send it further e.g. using tcp/ip stream.
Basic XSLT 1.0 doesn't allow you to construct more than one document
from a single transformation. However, there are two possible ways
around it.
First, you could create a single result that included both documents,
and then split it within your code in some way (through processing the
DOM or even parsing the result as a string). The result of an XSLT
transformation doesn't have to be a well-formed XML document - it can
break the usual rule about only having one document element.
Second, most XSLT processors have an extension element that allows you
to create several documents from the same transformation. You can use
one of these extension elements to create the two separate files, but
which one you can use depends on which processor you're using, which
you haven't divulged. If you read your processor's documentation,
you'll probably find a way of doing it (though, to save you looking,
not if your processor is MSXML).
If all else fails, you could always adapt your stylesheet so that it
accepts a parameter that tells it which document it should generate,
and then run it however many times you need to, with different values
for that parameter, to create separate files.
The next version of XSLT, XSLT 2.0, has a xsl:result-document element
that allows you to create several documents from the same
transformation.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list