[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Parsing two XML files at the same time
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>  <xsl:value-of select="string(normalize-space(content/title/.))"/>  <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
|
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
|