Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 23rd, 2009, 01:23 PM
Authorized User
 
Join Date: Nov 2009
Posts: 11
Thanks: 6
Thanked 0 Times in 0 Posts
Default Template match should find all elements ending in 'wp'

Hello,

I've been trying to use regular expressions to apply a template to all elements ending in 'wp' but nothing has worked. The code is pasted below:

<xsl:template match="what goes here?">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="wpno"><xsl:number count="*[@wpno]" format="0000" level="any" from="production"/><!--count counts the position of the wpno in the whole document, not by what is called in a template--></xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
 
Old November 23rd, 2009, 01:41 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You don't make it clear whether it is the element name or its value that must end in "wp". Assuming the name, write

match="*[ends-with(local-name(), 'wp')]"
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
Kenneth.Dougherty (November 23rd, 2009)
 
Old November 23rd, 2009, 02:16 PM
Authorized User
 
Join Date: Nov 2009
Posts: 11
Thanks: 6
Thanked 0 Times in 0 Posts
Default

It was the element name. Sorry for the confusion, and thanks very much for the help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Param in template match=" " iceandrews XSLT 2 May 7th, 2008 07:37 AM
template match doesnt match the required node Tomi XSLT 2 March 12th, 2007 06:24 AM
How to Only Match Elements that Equal an XSL Var? tclancy XSLT 1 April 21st, 2006 04:05 PM
Elements that don't match any templates clareE XSLT 3 December 21st, 2005 06:20 AM
how to match elements starting with roopa XSLT 1 October 20th, 2005 10:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.