Re: [xsl] Axis specifers

Subject: Re: [xsl] Axis specifers
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 16 Jan 2007 16:17:57 GMT
   This is the reason for the statement " <xsl:if
  test="child::note">
  <xsl:apply-templates select="note" mode="list"/> </xsl:if>"

Michael's point was that teh xsl:if there is doing nothing, those lines
are equivalent to
 <xsl:apply-templates select="note" mode="list"/> 

as in both cases, if there is a note, templates are applied, and if
there is not a note, templates are not applied.

Your example 

   
   <list>
    <note><para>This is the first note.</para></note>
   <note><para>This is the second note. </para></note>
   <text><para>This is some text. </para></text>
   <note><para>This note is after the text. </para></note>
    </list>
   
   So, only if the <note> element appeared before the text, it will have
   to be displayed before the text element like this:
   
   NOTE: This is the first note.
   NOTE: This is the second note.
   1. This is some text.

doesn't seem to involve any rearrangement at all and just needs
something like

<xsl:template match="list">
<block>
<xsl:apply-templates/>
</block>
</xsl:template>

<xsl:template match="note">
<block>NOTE:
<xsl:apply-templates/>
</block>
</xsl:template>

<xsl:template match="text">
<block><xsl:number/>.
<xsl:apply-templates/>
</block>
</xsl:template>

you say
.> If a 'note' element appeared immediately after the list element, 
but your example input didn't have a note after the list element, and
your posted code only appeared to be looking at child elements of list,
not following siblings.

David

Current Thread