Hi Mike. I think the problem is that your example uses a match pattern (http://www.w3.org/TR/xslt#patterns), rather than a full XSLT/XPath pattern. I don't think the XPath grouping expression ('(' Expr ')' -- part of a FilterExpr, http://www.w3.org/TR/xpath#NT-FilterExpr) is allowed in a match pattern. Note that both Saxon and XT will also throw an error on this.
If I take out the grouping expression in the match pattern, but use that expression as a select pattern, the stylesheet seems to build fine: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" xmlns:weirdns="#WeirdScenes" exclude-result-prefixes="weirdns"> <xsl:template match="/"> <xsl:apply-templates select="(/doc/a/b)[2]"/> </xsl:template> <xsl:template match="/doc/a/b[2]"> <out>found it!</out> </xsl:template> </xsl:stylesheet> Yields: <?xml version="1.0" encoding="UTF-8"?> 2 But note that your template doesn't fire in this case, because the proximity predicate is on the child, rather than the group. Frankly, I can't think of a good way to do this (i.e. make a proximity predicate on the group) as a match pattern off the top of my head. -scott Michael Wittmann To: [EMAIL PROTECTED] <[EMAIL PROTECTED] cc: (bcc: Scott Boag/CAM/Lotus) on.org> Subject: xpath expression problem (a/b/c)[2] 08/05/2001 10:19 AM hi, i'm having problems extracting the nth occurrence of a specific tag from a xml document. xml source: <doc> <a><b>1</b></a> <a><b>2</b></a> <a><b>3</b></a> </doc> i'm looking, say, for the 2nd occurrence of <b></b> using the following xsl: <xsl:template match="(/doc/a/b)[2]"> <out>found it!</out> </xsl:template> this works perfectly with a freeware tool "xpath tester" (version 1.0, from fivesight techn.), which uses xalan 2.1.0. it does not work, however, when using java org.apache.xalan.xslt.Process -in a.xml -xsl test.xsl on the command line. in the latter case, the output is: XSLT Error:(javax.xml.transform.TrabsformerConfigurationException): Extra illegal tokens: ')', '[', '2', ']' seemingly, the parenthesis-syntax is not legal. can anybody help? i'm using xalan-j 2.1.0 and java version 1.3.1; i tried xalan-j 2.2D6 on win2k. no difference. bye michael ps: please, reply cc to [EMAIL PROTECTED]
