|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: multiple input xml docs
> I have two xml documents, each of the two documents have the same
> structure but with different data and namespaces (ex:)
> (doc 1)
> <people xmlns="http://people.file1">
> <name>david</name>
> <name>glen</name>
> <name>travis</name>
> <people>
>
> (doc 2)
> <people xmlns="http://people.file2">
> <name>bob</name>
> <name>jim</name>
> <name>smith</name>
> <people>
>
> 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?? I have been trying for a
> while with
> no success. I have been using document() to take in the second xml
> file.
Have you tried testing namespace-uri() to see which namespace
each document's document element belongs to?
E.g. something like
<xsl:variable name="doc1" select="document('doc1.xml')" />
<xsl:variable name="doc2" select="document('doc2.xml')" />
<xsl:template match="/">
<xsl:for-each select="$doc1 | $doc2">
<xsl:when test="namespace-uri(.) = 'http://people.file1'">
<xsl:apply-templates select="." mode="mode1" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="mode2" />
</xsl:otherwise>
</xsl:for-each>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








