cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perry Molendijk" <pe...@inflexions.com>
Subject Re: work around for <xsl:text disable-output-escaping="yes">?
Date Wed, 27 Jun 2001 23:39:08 GMT
Try this:

<xsl:for-each select="parent/child[position() mod 2 = 0]">
<tr>
<td><xsl:value-of select="preceding-sibling::child/name"/></td>
<td><xsl:value-of select="name"/></td>
</tr>
</xsl:for-each>

and as you can see you can make this work for any number of columns: 

<xsl:for-each select="parent/child[position() mod 4 = 0]">
<tr> 
<td><xsl:value-of select="preceding-sibling::child[3]/name"/></td>
<td><xsl:value-of select="preceding-sibling::child[2]/name"/></td>
<td><xsl:value-of select="preceding-sibling::child[1]/name"/></td>
<td><xsl:value-of select="name"/></td>
</tr>
</xsl:for-each>

Just be aware that the preceding-sibling:: axis is a reverse axis so counting is reverse document
order.

Perry
  ----- Original Message ----- 
  From: Robert McKinnon 
  To: cocoon-users@xml.apache.org 
  Sent: Wednesday, June 27, 2001 8:22 PM
  Subject: work around for <xsl:text disable-output-escaping="yes">?


  Hello,

  I am trying to dynamically build table rows from an xml file.  The solution
  that I came across indicated that I would need to use <xsl:text
  disable-output-escaping="yes">.  When I tried to apply this solution I
  discovered that Cocoon does not support disable-output-escaping.  What would
  be an alternative solution?  The following are example snippets:

  [XML]
  <parent>
  <child>
  <name>child1</name>
  </child>
  <child>
  <name>child2</name>
  </child>
  <child>
  <name>child3</name>
  </child>
  <child>
  <name>child4</name>
  </child>
  <child>
  <name>child5</name>
  </child>
  <child>
  <name>child6</name>
  </child>
  </parent>

  [OUTPUT DESIRED]
  <tr>
  <td>child1</td>
  <td>child2</td>
  </tr>
  <tr>
  <td>child3</td>
  <td>child4</td>
  </tr>
  <tr>
  <td>child5</td>
  <td>child6</td>
  </tr>

  [RECOMMENDED XSL SOLUTION NOT SUPPORTED BY COCOON]
  <tr>
  <xsl:for-each select="parent/child">
  <td><xsl:value-of select="name"/></td>
  <xsl:if test="position() mod 2 = 0">
  <xsl:text disable-output-escaping="yes">
  <![CDATA[</tr><tr>]]>
  </xsl:text>
  </xsl:if>
  </xsl:for-each>
  </tr>




  ---------------------------------------------------------------------
  Please check that your question has not already been answered in the
  FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

  To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
  For additional commands, e-mail: <cocoon-users-help@xml.apache.org>



Mime
View raw message