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

RE: How to call extension function from xpath multiple

Subject: RE: How to call extension function from xpath multiple times?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 4 Jan 2005 12:40:20 -0000
how to call extension
Firstly, you don't need to repeat the same tests on both the apply-templates
and the match pattern. 

For problems involving extension functions, it's important to know which
product you are using.

Is the extension function actually being called? What happens if you
temporarily make the extension function always return true?

What does the source document look like?

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Manpreet Singh [mailto:singhm@xxxxxxxxxxx] 
> Sent: 04 January 2005 10:28
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  How to call extension function from xpath 
> multiple times?
> Importance: High
> 
> Hi,
> 
>   I am working with the following xsl:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dit="Tester">
> 	<xsl:template match="a">
> 		<xsl:apply-templates 
> select="*[dit:matchString('b_qstnmark_',local-name(.))]/a/*[di
t:matchString('c_qstnmark_',local-name(.))]"/>
> 	</xsl:template>
> 	<xsl:template 
> match="*[dit:matchString('b_qstnmark_',local-name(.))]/a/*[dit
:matchString('c_qstnmark_',local-name(.))]">
> 		<xsl:value-of select="concat(local-name(.), ' - ', .)"/>
> 	</xsl:template>
> </xsl:stylesheet>
> 
> The java class for the extension function i call is as follows:
> 
> import java.util.StringTokenizer;
> 
> public class Tester {
> 	public static boolean matchString(String pattern, 
> String elemName) {
> 		int index = pattern.lastIndexOf("/");
> 
> 		if(index != -1) {
> 		pattern = pattern.substring(index + 1);
> 		}
> 
> 		pattern = pattern.replaceAll("_asterix_", "\\\\w*");
> 		pattern = pattern.replaceAll("_qstnmark_", "\\\\w");
> 
> 		return java.util.regex.Pattern.matches(pattern, 
> elemName);
> 	}
> }
> 
> My problem is that the xpath of apply-templates above does 
> not work. My template below never gets a call.
> 
> Any Help?
> 
> Regards
> Manpreet Singh

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.