xsl-list
[Top] [All Lists]

RE: [xsl] "fetching" elements by name with a tokenized list of names

2007-02-16 02:54:58
The context changes inside a predicate, so "." inside [] is not normally the
same thing as "." outside the []. "*[name()=.]" selects elements whose name
is the same as their string-value.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Georges Schmitz [mailto:georges(_dot_)schmitz(_at_)heitec(_dot_)de] 
Sent: 16 February 2007 09:47
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] "fetching" elements by name with a tokenized 
list of names

I don't have a clue why this one works:

  <xsl:for-each select="tokenize($extract.element,';')">
    <xsl:variable name="name" select="."/>
    <xsl:copy-of select="$annex/*[name()=$name]"/>
  </xsl:for-each>

and this one not:

  <xsl:for-each select="tokenize($extract.element,';')">
    <xsl:copy-of select="$annex/*[name()=.]"/>
  </xsl:for-each>

tokenize() delivers a sequence of string tokens, so what 
makes the difference between referring to a string token in 
<xsl:for-each> by "."
directly (the latter) or by using an intermediary variable 
(the first case)?

Thanks for clearing this to me,
Georges


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>