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

need help on referencing

Subject: need help on referencing
From: Lenny Wu <lenny.wu@xxxxxxxxxxx>
Date: Fri, 14 Nov 2003 01:19:22 -0500
help with 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


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.