[xsl] pleaz help

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"
xmlns:page="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 -->

<xsl:eek:utput method="xml" indent="yes"/>

<xsl:param name="absolute_url"/>
<xsl:param name="upload_url"/>
<xsl:param name="cols" select="3"/>

<xsl:template match="/xc:xcontent">
<page:page 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() &lt; $cols]"/>
</tr>
</xsl:for-each>
</table>
</center>

</page:content>
</page:section>
</page:page>
</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

<page:page 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>
</page:page>




But the output is like this:


--

<page:page 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>
</page:page>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,742
Latest member
AshliMayer

Latest Threads

Top