xsl-list
[Top] [All Lists]

Re: [xsl] descendant-or-self XSLT 1.0

2006-03-20 06:54:18
On Monday 20 March 2006 8:36 am, cknell(_at_)onebox(_dot_)com wrote:
What Xpath do I have to use in XSLT 1.0 to get ALL <result/>

If you really care about only <result> elements, why not ignore 
everything else?

The basic ignore stylesheet is this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  <xsl:template match="*"> 
    <xsl:apply-templates/>
  </xsl:template>
</xsl:stylesheet>

Write one stylesheet based on the element(s) you do care about:
  <xsl:template match="result">
    <xsl:value-of select="text()"/>
  </xsl:template>

Combine:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  <xsl:output method="text"/>
  <!-- Ignore, but descend through every element -->
  <xsl:template match="*"> 
    <xsl:apply-templates/>
  </xsl:template>
  <!-- Except for the one I care about.. -->
  <xsl:template match="result">
    <xsl:value-of select="text()"/>
  </xsl:template>
</xsl:stylesheet>

xsltproc /work/tools/xslt/oneoff/xsl-list.xsl zoot.xml
123456


HTH,
Keith

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