Re: Basic FO questions

Tony

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:
quote
the first child of the <list> is the text node containing the newline 
before the first <item>.
unquote

Thanks.
Khaled

_The XML:_
<List ordered="yes">
<Item>text</Item>
...
<Item>text</Item>
</List>

_and the XSLT:_
<xsl:template match="Item">
        <fo:list-item>
            <fo:list-item-label>
                <xsl:if test="../@ordered='yes'">
                    <fo:block><xsl:number value="*position( )*"/>. 
</fo:block>    
                </xsl:if>
                <xsl:if test="../@ordered='no'">
                    <fo:block>&#62;</fo:block>
                </xsl:if></fo:list-item-label>
            <fo:list-item-body>
                <fo:block>
                    <xsl:apply-templates/>
                </fo:block>
            </fo:list-item-body>
        </fo:list-item>
    </xsl:template>


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