You can use the current() function to get the XSLT context node from within an
XPath:
<xsl:value-of
select="$documentAppConfig/configuration/myNode/@*[local-name()=current()/tex
t()]" />
Patrik
>
------------------------------------------------------------------
Systemarchitektur & IT-Projekte
Tel: +49 40 33449-1142
Fax: +49 40 33449-1400
E-Mail: mailto:Patrik.Stellmann@xxxxxxxxx
-----Urspr|ngliche Nachricht-----
> Von: Joseph L. Casale jcasale@xxxxxxxxxxxxxxxxx [mailto:xsl-list-
> service@xxxxxxxxxxxxxxxxxxxxxx]
> Gesendet: Mittwoch, 19. Juli 2017 01:53
> An: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Betreff: Fetching the value of a dynamically assigned attribute
>
> While mocking up some examples related to a previous question, I have an
> example where I add a namespace to my stylesheet and add some data to it:
>
> <myns:data>
> <foo>
> <bar>one</bar>
> <bar>two</bar>
> <bar>three</bar>
> </foo>
> </myns:data>
>
> I also load another XML doc I am using data from:
>
> <xsl:variable name="documentAppConfig"
> select="document('some_binary.exe.config')" />
>
> While looping over the elements from the data I added to my stylesheet, I
am
> trying to select the value of an attribute where the attribute name is
dynamically
> specified:
>
> <xsl:for-each select="document('')/xsl:stylesheet/myns:data/foo/bar">
>
> <!-- this works: -->
> <xsl:value-of select="concat('some-text', text())" />
>
> <!-- this does not work: -->
> <xsl:value-of
select="$documentAppConfig/configuration/myNode/@*[local-
> name()=text()]" />
>
> <!-- this works: -->
> <xsl:variable name="text" select="text()" />
> <xsl:value-of
select="$documentAppConfig/configuration/myNode/@*[local-
> name()=$text]" />
>
> </xsl:for-each>
>
> That result is not surprising, but what is the syntactically correct way of
> accomplishing this, or is the intermediate assignment the only way?
>
> Thanks,
> jlc
>
GDV Dienstleistungs-GmbH
Glockengie_erwall 1
D-20095 Hamburg
www.gdv-dl.de
Sitz und Registergericht: Hamburg
HRB 145291
USt.-IdNr : DE 205183123
Geschdftsf|hrer:
Dr. Jens Bartenwerfer
Michael Bathke
Fred di Giuseppe Chiachiarella
Thomas Fischer
Aufsichtsratsvorsitzender: Werner Schmidt
------------------------------------------------------------------
Diese E-Mail und alle Anhdnge enthalten vertrauliche und/oder rechtlich
gesch|tzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrt|mlich erhalten haben, informieren Sie bitte sofort den Absender
und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe der E-Mail ist nicht gestattet.
This e-mail and any attached files may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
|