xsl-list
[Top] [All Lists]

Re: [xsl] Axis specifers

2007-01-16 09:18:18

   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


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