At 2009-12-22 17:44 +0300, Ð?иÑ?аил СабÑ?Ñ?енков wrote:
I make two-pass transformation in my XSL using exsl:node-set (libxslt).
...
<xsl:template match="tree">
<node attr="foo"/>
</xsl:template>
...
<xsl:template match="@attr[/root/@condition='ru']" mode="parse">
...
Last template should (i hope so) match my @attr 'cause it's more exact.
(note below)
And it's working w/o predicate.
But it doesn't with.
Any thoughts why?
Because the "/" at the start of
"/root/@condition" is the top of the _current
tree_, not the top of the initial tree. Thus it
is at the top of the tree with the attribute
because it is in the predicate tested when the attribute is the current node.
You want a global variable something like:
<xsl:variable name="orig" select="/"/>
... and then in your predicate
@attr[$orig/root/@condition='ru'] in order to
switch to the original tree from your temporary tree.
The note about "more exact" is that is too
general a statement. Everything more complex
than a simple name all have the same
priority. The priority doesn't somehow steadily
increase with more and more information.
So, yes, "@attr[$orig/root/@condition='ru']" has
higher priority than "@attr" but it does not have
higher priority than, say,
"@attr[$orig/root/@condition='ru'][$orig/root/other1][$orig/root/other2]"
which is at the same numeric level of priority of .5.
I hope this helps.
. . . . . . . Ken
--
UBL and Code List training: Copenhagen, Denmark 2010-02-08/10
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30
Vote for your XML training: http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
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>
--~--