Re: [xsl] multiple input xml docs

Subject: Re: [xsl] multiple input xml docs
From: "J.Pietschmann" <j3322ptm@xxxxxxxx>
Date: Thu, 29 May 2003 21:10:03 +0200
Dave Dearman wrote:

I have two xml documents, each of the two documents have the same structure but with different data and namespaces (ex:)
...
What I want to accomplish is, read both of the xml files into a single
xsl and have it transform each of the files differently according to
their namespaces. Is this possible??

Yes.


I have been trying for a while with
no success.  I have been using document() to take in the second xml
file.

You probably forgot to use the namespaces in the match and select expressions: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:f1="http://people.file1"; xmlns:f2="http://people.file2";> <xsl:variable name="file2" select="document('file2.xml')"/>

 <xsl:template match="f1:name">
   <!-- look it up in file2 -->
   <xsl:if test=".=$file2/f2:people/f2:name>
  ....

Check the XSL FAQ for further details and explanations.

J.Pietschmann



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread