Subject: [xsl] How to call extension function from xpath multiple times? From: "Manpreet Singh" <singhm@xxxxxxxxxxx> Date: Tue, 4 Jan 2005 15:58:15 +0530 |
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/*[dit: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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XML Date/Time service upd, Daniel Bibbens | Thread | RE: [xsl] How to call extension fun, Michael Kay |
RE: [xsl] Computational complexity , Michael Kay | Date | FW: [xsl] How to call extension fun, Manpreet Singh |
Month |