Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] How to call extension function from xpath multiple times?

From: "Michael Kay" <mike@------------>
To:
Date: 1/4/2005 12:41:00 PM
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: [xsl] 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent