xsl-list
[Top] [All Lists]

Re: [xsl] Saxon node matching order

2008-11-28 10:03:52
At 2008-11-28 14:49 +0000, Ed Yau wrote:
I have a question about how Saxon chooses which node to match next.

I have some XML that looks a bit like this:

<x>
   <y>
      <z>Peter</z>
   </y>
   <z> </z>
   <y>
      <z>Jones</>
   </y>
</x>

What I'm trying to achieve is the follow:

<x>
      <z>Peter</z>
      <z> </z>
      <z>Jones</>
</x>

With the code below:

<xsl:template match="x" >
        <xsl:apply-templates select="y|z"/>
</xsl:template>

Have you considered:

<xsl:template match="x" >
        <xsl:apply-templates select=".//z"/>
</xsl:template>

... or is there some reason you need to know when you are going through <y>. You can always look from <z> to know what your parent is.

I hope this helps.

. . . . . . . Ken

--
Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes:
:  Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview:  http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
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>
--~--

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