Re: [xsl] Child locations

Subject: Re: [xsl] Child locations
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 25 Apr 2007 21:42:47 +0100
> I'm trying to prevent the first occurrence of a child tag from line

XSLT has no access to the tags in a document, you mean child element.


 <xsl:template match="amended/para">
this will only match teh para, some other code may or may not match your
catchline but you don't show it.

                <xsl:for-each select = "child::node()">
this is the same as
                <xsl:for-each select = "node()">

and selects all child nodes of the current para, in your exaple this is
always a single text node.

<xsl:when test="child::node()[not(.=normalize-space(.))][1][self::para]
the first sterp of this is selcting all child nodes of teh current text
nodes, text nodes never have any children so thi sset will always be
empty and test as false.

I think you want something like

<xsl:template match="ammended">
  <xsl:apply-templates select="para"/>
</xsl:template>

<xsl:template match="para">
<fo:block>
<xsl:if test="position()=1">
<fo:inline>
<xsl:apply-templates select="preceding-sibling::catchline"/>
<xsl:text> </xsl>text>
</fo:inline>
</xsl:if>
<xsl:apply-templates/>
</fo:block>
</xsl:template>

David

Current Thread