At 2009-03-04 17:27 -0800, Horace Burke wrote:
Yes, I tried my modified template. It didn't change anything. The
page number still starts at three "3" -- I am sure I am doing something wrong.
I have a guess ... but you don't show us your input data.
The template is applied by default rules.
Okay, so with the built-in template rules, that is in effect doing
the following:
<xsl:template match="some-element">
<xsl:apply-templates/>
</xsl:template>
So that means if you have the data:
<some-element>
<lang>
....stuff....
</lang>
<lang>
....stuff....
</lang>
<lang>
....stuff....
</lang>
</some-element>
And your template reads as follows:
<xsl:template match="lang">
<fo:page-sequence master-reference="Insrt-body-page">
<xsl:if test="position() = 1">
<xsl:attribute
name="initial-page-number">1</xsl:attribute>
</xsl:if>
... then <lang> is *not* the first child node of <some-element> and
you won't get your attribute. It is the first element node. The
first child node is the text node with the indentation of the <lang>
element's start tag. The position() would be returning "2" in the
illustration above, which is why you aren't getting initial-page-number="1".
Do you only have element children below <some-element>? If so, you
could avoid the built-in template rules and do the following:
<xsl:template match="some-element">
<xsl:apply-templates select="*"/>
</xsl:template>
... which will only push the element children to your stylesheet.
Or if you only have <lang> children you could do:
<xsl:template match="some-element">
<xsl:apply-templates select="lang"/>
</xsl:template>
Then if the first <lang> is the first element child of <some-element>
then the position() function would return "1" and you would get your
initial-page-number="1".
I hope I've guessed right and this helps. It is a common issue when
dealing with the built-in template rules and indented data.
. . . . . . . . . . . . Ken
--
XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--