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

Parsing two XML files at the same time

Subject: Parsing two XML files at the same time
From: "Vivek Shinde" <Vivek.Shinde@xxxxxxx>
Date: Tue, 8 Jul 2003 00:38:59 -0400
parsing two xml files
Hi,

I have 2 XML documents. One is my master that has all the articles and the other with only the article ids for the articles that I need to select from the first XML.

So, I am in the first XML, do some processing, write the IDs in the 2nd XML. Then I open 2nd XML, read the ID and now I want to go back to first XML, find the matching articles and list the descriptions for those. Any help is greatly appreciated.

Here's the code:

<xsl:apply-templates select="content/article" mode="details" />

<xsl:template match="article" mode="details">
<!-- c:\article_index.xml is the 2nd XML that contains only indices -->
<xsl:apply-templates select="document('c:\article_index.xml')" mode="proc-id"/>
</xsl:template>

<xsl:template match="//ID" mode="proc-id">
<xsl:variable name="articleid" select="." />
<xsl:value-of select="$articleid"/>
<!-- it works upto here. It gets the right id from 2nd file, but since it's pointing to 2nd XML, it does not now recognize string(content/id) from the next statement which should be from the 1st XML file --->
<xsl:value-of select="string(content/id/.)"/>
<xsl:when test="number(content/id/.) = $articleid" >
<xsl:text> </xsl:text>&#160;
<xsl:value-of select="string(normalize-space(content/title/.))"/>&#160;
<xsl:call-template name="strip-tags">
<xsl:with-param name="teaser" select="normalize-space(content/teaser/.)"/>
</xsl:call-template>
..........


The format for 2nd XML is 
<article>
  <id>1</id>
  <id>2</id>
</article>


Thanks
Vivek 

 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.