View Single Post
  #2 (permalink)  
Old November 14th, 2009, 07:41 PM
samjudson's Avatar
samjudson samjudson is offline
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

My first issue with your question is that you don't say what you want your XML output to look like, so it is hard to say if we are misunderstanding your intentions.

Firstly, I would make two templates, one matching the div, and then only processing the first p within in - this is far less intensive that using the preceding-sibling axis:

<xsl:template match="tei:div">
<xsl:apply-template select="tei:p[1]"/>
</xsl:template>

<xsl:template match="tei:div/tei:p">
[..]
</xsl:template>

I'm not sure the purpose of the <xsl:for-each> is as it does nothing.

Something like the following may work for the last part:

<xsl:variable name="sectTop" select=../../tei:div[@type='section'][1]/tei:p[1]=."/>
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
Reply With Quote
The Following User Says Thank You to samjudson For This Useful Post:
sarcanon (November 14th, 2009)