[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Matching attribute with condition in predicate

Subject: Matching attribute with condition in predicate
From: Михаил Сабуренков <jack.vosmerkin@xxxxxxxxx>
Date: Tue, 22 Dec 2009 17:44:16 +0300
 Matching attribute with condition in predicate
Hi,

I make two-pass transformation in my XSL using exsl:node-set (libxslt).
While identity-transforming everything by default, I filter out some nodes.
I think it's very widespread case:

XML:
<root condition='ru'><tree/></root>

XSL:
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:exsl="http://exslt.org/common"
  extension-element-prefixes="exsl">

  <xsl:template match="root">
    <xsl:variable name="nodeset">
      <xsl:apply-templates select="tree"/>
    </xsl:variable>
    <xsl:apply-templates select="exsl:node-set($nodeset)" mode="parse"/>
  </xsl:template>

  <xsl:template match="tree">
    <node attr="foo"/>
  </xsl:template>

  <xsl:template match="@*|node()" mode="parse">
     <xsl:copy>
      <xsl:apply-templates select="@*|node()" mode="parse"/>
     </xsl:copy>
  </xsl:template>

  <xsl:template match="@attr" mode="parse">
    <xsl:attribute name="attr">default</xsl:attribute>
  </xsl:template>

  <xsl:template match="@attr[/root/@condition='ru']" mode="parse">
    <xsl:attribute name="attr">matched</xsl:attribute>
  </xsl:template>

</xsl:stylesheet>

Last template should (i hope so) match my @attr 'cause it's more exact.
And it's working w/o predicate.

But it doesn't with.

Any thoughts why?

Thanks in advance,

Mike.

p.s. xsltproc -V:
Using libxml 20705, libxslt 10124 and libexslt 813
xsltproc was compiled against libxml 20632, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20632
libexslt 813 was compiled against libxml 20632

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.