xsl-list
[Top] [All Lists]

RE: [xsl] omitting a piece of text

2009-01-30 09:50:22
In my XSLT I match PW
<xsl:element name="p">
        <span class="current_ref_in_footnote">
                <xsl:apply-templates select="text()[1]"/>
        </span>
        <xsl:apply-templates/>
</xsl:element>


You're processing text()[1] twice. Simplest (in 2.0) is:

<xsl:element name="p">
        <span class="current_ref_in_footnote">
                <xsl:apply-templates select="text()[1]"/>
        </span>
        <xsl:apply-templates select="node() except text()[1]/>
</xsl:element>

Alternatively:

<xsl:element name="p">
  <xsl:apply-templates/>
</xsl:element>

<xsl:template match="PW/text()[1]">
  <span class="current_ref_in_footnote">
      <xsl:value-of select="."/>
  </span>
</xsl:template>
  

Michael Kay
http://www.saxonica.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>