This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: How can i convert the variable value into xpath
- From: Mike Ferrando <mikeferrando at yahoo dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Mon, 11 Mar 2002 12:20:51 -0800 (PST)
- Subject: Re: [xsl] How can i convert the variable value into xpath
- Reply-to: xsl-list at lists dot mulberrytech dot com
Mike B.,
Thanks alot! that is exactly what I needed. I decided that using
documents was alot better than using prefixed tags (below). I have
created these bogus examples to see how I can write just this one
function and get it to work. I will add the other filters later.
Much in debt,
Mike F.
XSL:
<xsl:template match="/">
<XC1011>
<xsl:apply-templates select="//C1011"/>
</XC1011>
</xsl:template>
<xsl:template match="C1011">
<xsl:variable name="array" select="document('LLP.xml')//myitem"/>
<xsl:for-each select=".">
<xsl:variable name="getit" select="."/>
<xsl:for-each select="$array">
<xsl:variable name="item" select="node()"/>
<xsl:if test="$getit = $item">
<xsl:copy-of
select="document('UUL.xml')//var[@name=current()/@LINK]/node()"/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
LLP.xml:
<LLP>
<myitem LINK="r1">[Letter] included in We're staying here *in* I
Remember Mama *root* RODGERS1</myitem>
<myitem LINK="r2">[Lyric sheets and lyric sketches for Me and Juliet]
*in* Me and Juliet *root* RODGERS1</myitem>
<myitem LINK="r3">[Lyric sheets for I Remember Mama] *in* I Remember
Mama *root* RODGERS1</myitem>
</LLP>
UUL.xml:
<UUL>
<var name="r1"><B>[Letter...r1]</B> </var>
<var name="r2"><U>[Lyric sheets...r2]</U></var>
<var name="r3"><S>[Lyric sheets for...r3]</S></var>
</UUL>
XML (source):
<UL>
<C1011>[Letter] included in We're staying here *in* I Remember Mama
*root* RODGERS1</C1011>
<C1011>[Lyric sheets and lyric sketches for Me and Juliet] *in* Me
and Juliet *root* RODGERS1</C1011>
<C1011>[Lyric sheets for I Remember Mama] *in* I Remember Mama
*root* RODGERS1</C1011>
</UL>
OUTPUT:
<XC1011>
<B>[Letter...r1]</B>
<U>[Lyric sheets...r2]</U>
<S>[Lyric sheets for...r3]</S>
</XC1011>
__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list