[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Carlos Problem (II) how to show some results y som

Subject: Re: Carlos Problem (II) how to show some results y some places:
From: "Agnes Kielen" <a.kielen@xxxxxxx>
Date: Fri, 10 May 2002 13:46:50 +0200
templates inmobiliarias
Hello Carlos,

Another solution it is based at the first xml you send to this list.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="row" select="3"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="/NUMBERS">
 <html>
  <head/>
  <body>

   <table border="1">
    <tr>
    <!-- select the first 3 nodes -->
       <xsl:apply-templates select='NUMBER[(position() &lt; $row) or
(position() = $row) ]'/>
    </tr>
   </table>
  </body>
 </html>
  </xsl:template>

 <xsl:template match="NUMBER">
 <td>
   <xsl:apply-templates />
  </td>
  </xsl:template>


  <xsl:template match="VALUE">
 <xsl:value-of select="."/>
 <xsl:text>&#x20;</xsl:text>
<!-- select the node which is $row numbers from the current node -->
<xsl:apply-templates select="../following::NUMBER[$row]/VALUE"/>
  </xsl:template>

</xsl:stylesheet>

----- Original Message -----
From: "Carlos" <linux@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, May 10, 2002 10:45 AM
Subject: Re:  Carlos Problem (II) how to show some results y some
places:


> is a very good method but i need other thing; in the fist td 1 4 7
elements,
> in the second 2 5 8 in the tree elemnt 3 6 9
> can anybody help me please, i must to solve this problem in my hob, i am
> exasperated, i am working in this problem one week and i cannot solve.
> please help me
>
>
> i want to present in this form:
> <table>
> <tr>
> <td>1 4 7....</td><td>2 5 8....</td><td>3 6 9....</td>
> </tr>
> </table>
> and i dont want:
> <table>
> <tr>
> <td>1</td><td>2</td><td>3</td>
> </tr>
> <tr>
> <td>4</td><td>5</td><td>6</td>
> </tr>
> <tr>
> <td>7</td><td>8</td><td>9</td>
> </tr>
> </table>
>
> i have this xml and this 2 xslt tempaltes but i dont know how to lake in
> correct mode
>
> ##################
> XML
> ##################
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <INMOBILIARIAS>
>     <REGISTRO>
>         <REFERENCIA>1
>         </REFERENCIA>
>     </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>2
>         </REFERENCIA>
>      </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>3
>         </REFERENCIA>
>      </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>4
>         </REFERENCIA>
>     </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>5
>         </REFERENCIA>
>     </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>6
>         </REFERENCIA>
>     </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>7
>         </REFERENCIA>
>      </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>8
>         </REFERENCIA>
>      </REGISTRO>
>     <REGISTRO>
>         <REFERENCIA>9
>         </REFERENCIA>
>      </REGISTRO>
> </INMOBILIARIAS>
>
> #####################
> the XSL
> ####################
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="html"/>
> <xsl:param name="cols" select="3"/>
> <xsl:param name="rows" select="3"/>
> <xsl:param name="by" select="'row'"/>
> <xsl:template match="/INMOBILIARIAS">
>     <html>
>         <head></head>
>         <body>
>             <xsl:apply-templates select="REGISTRO[position() mod ($rows *
> $cols) = 1]" mode="table"/>
>         </body>
>     </html>
> </xsl:template>
>
> <xsl:template match="REGISTRO" mode="table">
>     <table border="1">
>         <xsl:variable name="items-in-this-table" select=". |
> following-sibling::REGISTRO[position() &lt; ($rows * $cols)]"/>
>         <xsl:choose>
>             <xsl:when test="$by = 'row'">
>                 <xsl:apply-templates
select="$items-in-this-table[position()
> mod $cols = 1]" mode="row"/>
>             </xsl:when>
>             <xsl:when test="$by = 'col'">
>                 <xsl:apply-templates
select="$items-in-this-table[position()
> &lt;= $rows]" mode="row"/>
>             </xsl:when>
>         </xsl:choose>
>         <!-- here you can implement some logic for filling the last table,
> if there are not enough items to fill all <td>s -->
>     </table>
> </xsl:template>
>
> <xsl:template match="REGISTRO" mode="row">
>     <tr>
>         <xsl:choose>
>             <xsl:when test="$by = 'row'">
>                 <xsl:apply-templates select=". |
> following-sibling::REGISTRO[position() &lt; $cols]"/>
>             </xsl:when>
>             <xsl:when test="$by = 'col'">
>                 <xsl:apply-templates select="(. |
> following-sibling::REGISTRO)[position() &lt; ($cols * $rows)][position()
mod
> $rows = 1]"/>
>             </xsl:when>
>         </xsl:choose>
>     </tr>
> </xsl:template>
> <xsl:template match="REGISTRO">
>     <td>
>        <xsl:value-of select="./REFERENCIA"/><br/>
>     </td>
> </xsl:template>
> </xsl:stylesheet>
>
> #######################
> or this XSLT template
> #######################
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="html"/>
>   <xsl:template match="/">
>        <xsl:apply-templates select="*" />
>   </xsl:template>
>   <xsl:template match="/">
> <table border="2" width="200">
> <tr>
> <xsl:for-each select="/INMOBILIARIAS/REGISTRO">
> <xsl:if test="position() mod 3 = 1 or position()=1">
> <xsl:call-template name="Make3ColumnRow">
> <xsl:with-param name="FirstItemPositionNo">
> <xsl:value-of select="position()"/>
> </xsl:with-param>
> </xsl:call-template>
> </xsl:if>
> </xsl:for-each>
> </tr></table>
> </xsl:template>
> <xsl:template name="Make3ColumnRow">
> <xsl:param name="FirstItemPositionNo"/>
> <tr>
> <td >
> <xsl:value-of
>
select="/INMOBILIARIAS/REGISTRO[position()=$FirstItemPositionNo]/REFERENCIA"
> /><BR/>
> </td>
> <td >
> <xsl:value-of
>
select="/INMOBILIARIAS/REGISTRO[position()=$FirstItemPositionNo+1]/REFERENCI
> A"/><BR/>
> </td>
> <td >
> <xsl:value-of
>
select="/INMOBILIARIAS/REGISTRO[position()=$FirstItemPositionNo+2]/REFERENCI
> A"/><BR/>
> </td></tr>
>   </xsl:template>
> </xsl:stylesheet>
>
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.