|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] need help on referencing
Hi,
i found the following example on one of the older post about referencing from another xml file. I have another question. look below "tutorial.xml
<tutorial>
<author idref="1"/>
</tutorial>author.xml
<authors>
<author id="1">
<name>foo</name>
</author>
<author id="2">
<name>bar</name>
</author>
</authors>XSL
<xsl:template match="tutorial">
<xsl:copy>
<xsl:apply-templates select="author"/>
</xsl:copy>
</xsl:template>
<xsl:template match="author">
<xsl:copy>
<xsl:copy-of select="document('author.xml')/authors/author[@id =
current()/@idref]/name"/>
</xsl:copy>
</xsl:template>output should be:
<tutorial>
<author>
<name>foo</name>
</author>
</tutorial>
"Now my question is, if my xml code is like this : tutorial.xml (which is transformed)
<tutorial>
<author> 1 </author>
</tutorial>author.xml
<authors>
<author>
<id> 1 </id>
<name>foo</name>
</author>
<author>
<id> 2 </id>
<name>bar</name>
</author>
</authors>How would I write my xsl code to reference the other xml file to get the desired output? 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
|

Cart








