[Home] [By Thread] [By Date] [Recent Entries]
Hi there,
I'm attempting (using XSL 1.0 and Saxon 6.5.5) to do drop-caps by matching the first text element in the first paragraph of the second div0 in a TEI document. Where the text node is a direct child of the p tag, this works: <xsl:template match="div0[2]/p[1]/text()[1]"> However, where another tag intervenes in the tree, this fails: <div0> <p> <title>Blah</title> was published in... </p> </div0> Here, the first text node is the one following the title tag, which is wrong. So what I want to do is select the first text node which is a descendant (rather than a direct child) of the p tag. I just can't find a way to do this. If I use this: <xsl:template match="div0[2]/p[1]/descendant::text()[1]"> oXygen complains that "Axis in pattern must be child or attribute", meaning presumably that only element nodes, not text nodes, can be selected using this axis. If I use this: <xsl:template match="div0[2]/p[1]//text()[1]"> then I get all text nodes which are the first child of their parents, rather than only the first text node which is a descendant of the p tag. Can anyone suggest how to go about selecting the first text node which is a descendant of the p tag? All help appreciated, Martin -- Martin Holmes University of Victoria Humanities Computing and Media Centre (mholmes@xxxxxxx) Half-Baked Software, Inc. (mholmes@xxxxxxxxxxxxxxxxxxxxx) martin@xxxxxxxxxxx
|

Cart



