Subject: [xsl] Parsing two XML files at the same time From: "Vivek Shinde" <Vivek.Shinde@xxxxxxx> Date: Tue, 8 Jul 2003 00:38:59 -0400 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Parsing two XML files at , Michael Kay | Thread | [xsl] "Simple" copy all and find an, Kai heiko Lienemann |
[xsl] Parsing two XML files at the , Vivek Shinde | Date | RE: Is XML a Language? (was RE: [xs, bryan |
Month |