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

Re: Selecting the value from diff i/p XML

Subject: Re: Selecting the value from diff i/p XML
From: Syd Bauman <Syd_Bauman@xxxxxxxxx>
Date: Wed, 15 Sep 2010 19:08:34 -0400
Re:  Selecting the value from diff i/p XML
I'm not 100% sure I understand what OP wants, but the following XSLT
1.0 program generates what I think is the desired output, albeit
probably a lot less efficiently than could be done with clever keys.

Note that I couldn't bring myself to have attributes named id= that
are not xsd:ID, so I renamed it to record=.

<?xml version="1.0" encoding="UTF-8"?>
<!-- read in Root2 as input, and correlate the record= -->
<!-- of each <data> with the corresponding record= of -->
<!-- an <item> in Root1, and spit out the value= of -->
<!-- the first match -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <wrapper>
      <xsl:apply-templates select="root2/data"/>
    </wrapper>
  </xsl:template>

  <xsl:template match="data">
    <out>
      <xsl:value-of select="@record"/>
      <xsl:text>=</xsl:text>
      <xsl:value-of select="document('./Root1.xml')/root1/item[@record=current()/@record]/@value"/>
    </out>
  </xsl:template>

</xsl:stylesheet>

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.