xsl-list
[Top] [All Lists]

[xsl] document() vs. current()

2006-06-22 10:41:25
I hope that this hasn't been asked here before - at least I did not find a 
solution searching through the list archive:

My XSL contains a lookup table im accessing via document(''). In order to know, 
which value I need to look up, I have to get another value from my input XML. 
Im trying something like that:

INPUT:

<dd>
        <vd name="aName" val="aValue"/>
        <vd name="anotherName" val="anotherValue"/>
        <vd name="x" val="1"/>
</dd>


XSL:

<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:date="My Date Namespace">
        <xsl:template match="/">
                <xsl:value-of 
select="document('')//date:months/date:month[(_at_)nr = /dd/vd[(_at_)name 
='x']/@val]/@name"/>
        </xsl:template>
        <date:months>
                <date:month nr="1" name="Januar"/>
                <date:month nr="2" name="Februar"/>
                <date:month nr="3" name="März"/>
                <!-- and so on -->
        </date:months>
</xsl:stylesheet>


If I change

/dd/vd[(_at_)name ='x']/@val

into its actual value (1), everything works fine...

So I thought that perhaps the function document() changes the context and I 
have to use the function current(), but I did not get the result I expected...

What am I doing wrong?

Best regards,
Marco Plum

*****************************************
Marco Plum
s<e>mantics Kommunikationsmanagement GmbH
Theaterstraße 106 D - 52062 Aachen
Tel: +49 241 89498944
Fax: +49 241 89498930
eMail: m(_dot_)plum(_at_)semantics(_dot_)de
Web: www.semantics.de
 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>