paul wrote:
oh my gosh, I just noticed a huge mistake on my part. My first page actually has
never been blank, but there was a tiny text on there. unwanted text, for some
xpath-mistake on my side it got printed too. So I guess with my for-each loop I
managed to avoid printing this text and therefore avoided the first pagebreak
with an almost empty page. I'm sorry for unnecessary posting, hope I didn't
steal too much of your time. Still learning...
Your best bet for questions on XSLT is the XSLT list.
The reason for this text is likely the following: the default template
for any content is the same as the xsl:value-of, which extracts the
text. If you fail to supply a root template match, it is likely that for
missed template matches, the default template is called. Consider:
<a>
text
<b>other text</b<
</a>
The following stylesheet will output both "text" and "other text":
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
</xsl:stylesheet>
The following stylesheet will so too, because it only matches "b" nodes
with "a" as parent. The "a" node does not have a match and so will fall
into the default template:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="a/b">
<xsl:value-of select="." />
</xsl:template>
</xsl:stylesheet>
The following stylesheet will only print "other text":
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:stylesheet match="/">
<xsl:apply-templates select="a/b" />
</xsl:stylesheet>
<xsl:template match="b">
<xsl:value-of select="." />
</xsl:template>
</xsl:stylesheet>
When nodes do not contain bare text but only child nodes and attributes,
this is not a problem. However, this is seldom the case (consider
whitespace nodes, they are almost always there) and so it is good
practice to start a new template using the root match and go from there.
Cheers,
-- Abel Braaksma
http://www.nuntia.nl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]