W3C home > Mailing lists > Public > www-xsl-fo@w3.org > November 2007

Re: Basic FO questions

From: Khaled Aly <ka.aly@luxsci.net>
Date: Wed, 07 Nov 2007 19:20:20 +0200
Message-ID: <4731F3D4.10706@luxsci.net>
To: Tony Graham <Tony.Graham@MenteithConsulting.com>
CC: www-xsl-fo@w3.org

Yes, I guess this one is an xslt issue, but what you wrote below sounds 
relevant, because some every-other-node that is not meant for display 
seems always counted. So, I get the list numbered: 2, 4, 6, ... this is 
apart from the extra white space pbm). The position() function should 
return a number equal to the position of the current node in the context 
node-set, which is "List".

Can you please elaborate this statement re the newline before the item:
the first child of the <list> is the text node containing the newline 
before the first <item>.


_The XML:_
<List ordered="yes">

_and the XSLT:_
<xsl:template match="Item">
                <xsl:if test="../@ordered='yes'">
                    <fo:block><xsl:number value="*position( )*"/>. 
                <xsl:if test="../@ordered='no'">

Tony Graham wrote:
> Both of these sound like XSLT problems where you have whitespace text
> nodes between your element nodes that you aren't considering.
> Making up an example, if your XML was:
> <list ordered="yes">
> <item/>
> <item/>
> </list>
> then the first child of the <list> is the text node containing the
> newline before the first <item>.
> You can either select only the nodes you are interested in by using
> @select on your <xsl:apply-templates>, or you can strip the whitespace
> nodes from the source tree using a top-level <xsl:strip-space> [1],
> e.g., <xsl:strip-space elements="list"/> for my example.
> Regards,
> Tony Graham.
> ======================================================================
> Tony.Graham@MenteithConsulting.com   http://www.menteithconsulting.com
> Menteith Consulting Ltd             Registered in Ireland - No. 428599
> Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
> ----------------------------------------------------------------------
> Menteith Consulting -- Understanding how markup works
> ======================================================================
> [1] http://www.w3.org/TR/xslt#strip
Received on Wednesday, 7 November 2007 17:21:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:58:31 UTC