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

RE: multiple input xml docs

Subject: RE: multiple input xml docs
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Thu, 29 May 2003 14:25:36 -0500
multiple input xml
> 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


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.