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]

Reply via email to