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

RE: check if nodes match xpath expression

Subject: RE: check if nodes match xpath expression
From: "Mabry, F. DR EECS" <df6954@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Nov 2000 14:24:40 -0500
matches xpath
I don't believe that you can in standard XSL-T (version 1.0) have a
"variable" reference in your XSL-T template match Xpath expression.  Saxon
has an extension (which will probably/hopefully be included in version 1.1)
that allows use of such a reference in the match of a template.

An alternative is to use XSL-T to construct a transform file that makes the
parameter a constant and do the transform in two steps.  This is similar to
the Schematron XSL-T of RJ.  Let me know if you pursue it and need further
help.  

Check at:
http://users.iclway.co.uk/mhkay/saxon/
or 
http://users.iclway.co.uk/mhkay/saxon/saxon6.0.1/index.html

for information.  

Mike Kay's book "XSLT Programmer's Reference" at page 118 has a complete
explanation of the problems associated with allowing attribute value
templates in Xpath expressions.

Hope this helps. 

Frank

Dr. Frank J. Mabry, Jr.
Dept. of EE&CS
U.S. Military Academy
West Point, NY 10996
Phone: 845-938-2960
Email: df6954@xxxxxxxxxxxxxxx


 -----Original Message-----
From: 	Christian Nentwich [mailto:c.nentwich@xxxxxxxxxxxx] 
Sent:	Thursday, November 30, 2000 12:27 PM
To:	XSL-List@xxxxxxxxxxxxxxxx
Subject:	check if nodes match xpath expression


Dear all,

we have produced a simple stylesheet that transforms an XML document
into a simple HTML document, with tags in colours, etc. (like the IE5
default stylesheet).

We also have a parameter containing an xpath expression that can be
applied to the XML file. We want to highlight nodes in the translated
HTML page that match the xpath expression, e.g. the stylesheet looks
like this:

<xsl:param name="xpath"/>
....
<xsl:template match="node()">
  ..
</xsl:template>

This problem seems to appear in different forms in the FAQ but I
couldn't find a proper solution. I know that

<xsl:template match="$xpath">..</..>

won't work. Similarly,

<xsl:template match="node()">
  <xsl:choose>
     <xsl:when test="somefunc(.,$xpath)"/>
  </xsl:choose>
</xsl:template>

to check whether the current node matches the xpath, since there is no
such function.

Has anyone had a similar problem?

Thanks,
Christian


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.