Subject: Re: [xsl] great problem formating the output in 2 columns From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 11 May 2004 15:51:16 +0100 |
You have two templates matching / <xsl:template match="/"> ... <xsl:template match="/"> That is an error and some systems will produce no output, however the system is allowed to recover by ignoring the first template, so you should delete <xsl:template match="/"> <xsl:apply-templates select="*" /> </xsl:template> <xsl:if test="position() mod 2 = 1 or position()=1"> if position is 1 then it is 1 mod 2 so the above is exactly the same as <xsl:if test="position() mod 2 = 1"> <xsl:with-param name="FirstItemPositionNo"> <xsl:value-of select="position()"/> </xsl:with-param> You don't want to do that; that makes a result tree fragment with a root node containing a text node with the string value of the decimal representation of the number. You can just do <xsl:with-param name="FirstItemPositionNo" <xsl:value-of select="position()"/> which just directly makes the parameter the number which is much more efficient, however you don't really want to do this if you pass the number you have to search the whole document to find the node you want (see below) <xsl:value-of select="/sn_servicioproyecto/informacion/sn_masterinformacion[position()=$FirstItemPositionNo] Note that isn't actually the right node as $FirstItemPositionN is set using the position() in the for-each so is numbered across the whole document but /sn_servicioproyecto/informacion/sn_masterinformacion[position() refers to the position of the sn_masterinformacion nodes as a child of its parent, in your example post, each informacion had exactly one such node so they all have position 1. You could go <xsl:value-of select="(/sn_servicioproyecto/informacion/sn_masterinformacion)[position()=$FirstItemPositionNo] with the exxtra braces so position() won't always be 1, but there is really no need to do that. You don't need ths param at all, when you call <xsl:call-template name="Make2ColumnRow"> the current node is your odd numbered sn_masterinformacion so inside Make2ColumnRow the two nodes that you want are <td><xsl:value-of select="."/></td> <td><xsl:value-of select="following:sn_masterinformacion[1]"/></td> David -- The LaTeX Companion http://www.awprofessional.com/bookstore/product.asp?isbn=0201362996 http://www.amazon.co.uk/exec/obidos/tg/detail/-/0201362996/202-7257897-0619804 ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] great problem formating the o, Dionisio Ruiz de Zar | Thread | [xsl] Generate Yahoo-like directory, Philipp Burkert |
Re: [xsl] docbook - fo - pdf XInclu, Eliot Kimber | Date | [xsl] Generate Yahoo-like directory, Philipp Burkert |
Month |