This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
loading multiple documents using variables
- From: Ralph Holz <Ralph dot Holz at unique dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 04 Apr 2002 15:25:35 +0100
- Subject: [xsl] loading multiple documents using variables
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi,
I have the following scenario here:
My XML files contains elements with "id" attributes, which serve as "links"
to several files, as in this example:
<doc id="byers01" />,
where "byers01" actually refers to a file called "byers01.xml".
(Yes, there is a reason why I don't want to add the file extension in the
@id. I need it elsewhere, too!)
What I'd like to do now is load multiple documents during the
transformation process, something like:
<xsl:for-each select="doc">
<xsl:variable name="name"><xsl:value-of select="@id" /></xsl:variable>
<xsl:apply-templates select="document('C:\{$name}.xml')" />
</xsl:for-each>
I'd like to use Xalan Java 2 for this.
The error I get now is that document() needs a valid URI as input, and "{"
is an offending character:
(Location of error unknown)XSLT Error
(javax.xml.transform.TransformerException):
javax.xml.transform.TransformerException: org.apache.xml.utils.URI$MalformedUR
IException: Path contains invalid character: {
Obviously, the $name variable is not resolved, but seen as part of the URI
argument of document().
Does anyone have an idea how I can load and process multiple documents in
such a for-each construction? I'd like to keep my "data format" (ids as
links...) as it is.
Thanks a lot,
Ralph
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list