T
Tjerk Wolterink
I have xsl code like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlnsage="http://www.wolterinkwebdesign.com/xml/page"
xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent">
<xsl:include href="xsl/xhtml/standard.xsl"/>
<xsl:include href="xsl/xhtml/collectielib.xsl"/>
<!-- the file collectielib.xsl defines templates for xc:fauteuil elements -->
<xslutput method="xml" indent="yes"/>
<xslaram name="absolute_url"/>
<xslaram name="upload_url"/>
<xslaram name="cols" select="3"/>
<xsl:template match="/xc:xcontent">
<pageage type="module">
<page:section>
<page:content>
<h2>Fauteuils</h2>
<center>
<table class="collectie">
<xsl:for-each select="./xc:fauteuil[(position() mod $cols)=1]">
<xsl:sort data-type="text" select="xc:naam" order="descending"
/>
<tr>
<xsl:apply-templates select="."/>
<xsl:apply-templates
select="following-sibling::xc:fauteuil[position() < $cols]"/>
</tr>
</xsl:for-each>
</table>
</center>
</page:content>
</page:section>
</pageage>
</xsl:template>
</xsl:stylesheet>
But with an XML input like this:
----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xc:xcontent [
<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"schema/xhtml/xhtml1-strict.dtd">%xhtml;]>
<xc:xcontent xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent"
xmlns="http://www.w3.org/1999/xhtml" module="collectie">
<xc:content type="html">
<xc:empty/>
</xc:content>
<xc:fauteuil>
<xc:id>1</xc:id>
<xc:naam type="string"><![CDATA[test]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[test]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut1.JPG]]></xc:foto>
<xc:content type="html">
etet
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>2</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>3</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>4</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>5</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>6</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>7</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
</xc:xcontent>
----
now i want this to be sort of like this
<pageage type="module">
<page:section>
<page:content>
<h2>Fauteuils</h2>
<center>
<table class="collectie">
<tr>
- fauteuil1
- fauteuil2
- fauteuil3
</tr>
<tr>
- fauteuil4
- fauteuil5
- fauteuil6
</tr>
<tr>
- fauteuil7
</tr>
</xsl:for-each>
</table>
</center>
</page:content>
</page:section>
</pageage>
But the output is like this:
--
<pageage type="module">
<page:section>
<page:content>
<h2>Fauteuils</h2>
<center>
<table class="collectie">
<tr>
- fauteuil7
</tr>
<tr>
- fauteuil1
- fauteuil2
- fauteuil3
</tr>
<tr>
- fauteuil4
- fauteuil5
- fauteuil6
</tr>
</xsl:for-each>
</table>
</center>
</page:content>
</page:section>
</pageage>
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlnsage="http://www.wolterinkwebdesign.com/xml/page"
xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent">
<xsl:include href="xsl/xhtml/standard.xsl"/>
<xsl:include href="xsl/xhtml/collectielib.xsl"/>
<!-- the file collectielib.xsl defines templates for xc:fauteuil elements -->
<xslutput method="xml" indent="yes"/>
<xslaram name="absolute_url"/>
<xslaram name="upload_url"/>
<xslaram name="cols" select="3"/>
<xsl:template match="/xc:xcontent">
<pageage type="module">
<page:section>
<page:content>
<h2>Fauteuils</h2>
<center>
<table class="collectie">
<xsl:for-each select="./xc:fauteuil[(position() mod $cols)=1]">
<xsl:sort data-type="text" select="xc:naam" order="descending"
/>
<tr>
<xsl:apply-templates select="."/>
<xsl:apply-templates
select="following-sibling::xc:fauteuil[position() < $cols]"/>
</tr>
</xsl:for-each>
</table>
</center>
</page:content>
</page:section>
</pageage>
</xsl:template>
</xsl:stylesheet>
But with an XML input like this:
----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xc:xcontent [
<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"schema/xhtml/xhtml1-strict.dtd">%xhtml;]>
<xc:xcontent xmlns:xc="http://www.wolterinkwebdesign.com/xml/xcontent"
xmlns="http://www.w3.org/1999/xhtml" module="collectie">
<xc:content type="html">
<xc:empty/>
</xc:content>
<xc:fauteuil>
<xc:id>1</xc:id>
<xc:naam type="string"><![CDATA[test]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[test]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut1.JPG]]></xc:foto>
<xc:content type="html">
etet
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>2</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>3</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>4</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>5</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>6</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
<xc:fauteuil>
<xc:id>7</xc:id>
<xc:naam type="string"><![CDATA[rutger]]></xc:naam>
<xc:afmetingen type="string"><![CDATA[rutger]]></xc:afmetingen>
<xc:foto type="img" width="2592" height="1944"><![CDATA[Rutger
faut2.JPG]]></xc:foto>
<xc:content type="html">
rr
</xc:content>
</xc:fauteuil>
</xc:xcontent>
----
now i want this to be sort of like this
<pageage type="module">
<page:section>
<page:content>
<h2>Fauteuils</h2>
<center>
<table class="collectie">
<tr>
- fauteuil1
- fauteuil2
- fauteuil3
</tr>
<tr>
- fauteuil4
- fauteuil5
- fauteuil6
</tr>
<tr>
- fauteuil7
</tr>
</xsl:for-each>
</table>
</center>
</page:content>
</page:section>
</pageage>
But the output is like this:
--
<pageage type="module">
<page:section>
<page:content>
<h2>Fauteuils</h2>
<center>
<table class="collectie">
<tr>
- fauteuil7
</tr>
<tr>
- fauteuil1
- fauteuil2
- fauteuil3
</tr>
<tr>
- fauteuil4
- fauteuil5
- fauteuil6
</tr>
</xsl:for-each>
</table>
</center>
</page:content>
</page:section>
</pageage>