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

Re: too many columns

Subject: Re: too many columns
From: "Gabi Bucataru" <gabi@xxxxxxxxxxxxxxxxx>
Date: Thu, 24 Oct 2002 16:28:58 -0500
color text in xslt
Thanks Mike,


I tried this latest XSL and I added another section in my XML (A7) like
this:

[...]
<Column>
<Caption>Spare</Caption>
<Colnr>A7</Colnr>
</Column>
</Columns>
<People>
<Person>
<Data>
<A1 color="000000">Note</A1>
<A2 color="000000"/>
<A3 color="000000">Note</A3>
<A4 color="000000"/>
<A5 color="000000">Note</A5>
<A6 fond="C0C0C0" color="D7AC00">2-MICALI,PAT-4053 </A6>
<A7 fond="C0C0C0" color="D7AC00">Exemple </A7>
[...]

Well, the new column header (Spare) is added ok., but the cells are black
with nothing in them. Instead the A7 element's data "Example" appears in a
separate row BEFORE the table.

I think I am missing something...

Thanks again,
Gabi.



----- Original Message -----
From: "Mike Brown" <mike@xxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, October 24, 2002 2:00 PM
Subject: Re:  too many columns


> Gabi Bucataru wrote:
> > 1.
> > See,  the thing is that i will never know how many of those A1, A2
elements
> > (and so on)  I will have. Once it might be only 2, 4, who knows. So is
there
> > a way that I can make the template dynamic? I mean this one (now I have
6
> > A's there):
> >
> > <xsl:template match="A1|A2|A3|A4|A5|A6">
>
> But you handle each of these elements the same way, so this template does
not
> really need to change. What needs to change is how you arrive at this
> template: the selection of nodes for processing (xsl:apply-templates or
> xsl:for-each).
>
> Also, in the stylesheet I posted for you, I didn't mean to use
mode="thead"..
> that was leftover from an experiment.
>
> > 2.
> > The second question is that I would like to start look into XSLT 1.0...
Can
> > you please point me to a resource to learn that? I would like to make
this
> > move.
>
> 1. The book "Beginning XSLT" by Jeni Tennison
> 2. The book "XSLT Reference" by Michael Kay
> 3. These free excerpts from other books:
>     . http://www.ibiblio.org/xml/books/bible2/chapters/ch17.html
>     . http://www.cranesoftwrights.com/training/#ptux-dl
>     . http://www.oreilly.com/catalog/orxmlapp/chapter/index.html
> 4. http://www.vbxml.com/xsl/tutorials/intro/default.asp (decent tutorial)
> 5. http://www.zvon.org/xxl/XSLTutorial/Output/index.html (learn by
example)
>
> You are lucky I didn't delete the XSLT 1.0 version of your stylesheet that
I
> had dumbed down to make work with the WD-xsl namespace.
>
> I cannot imagine making this new one work with the WD-xsl namespace,
though,
> because it makes use of XSLT 1.0 instructions like xsl:variable and
functions
> like current(), local-name(), and string(). No one who uses XSLT would
want to
> have to live without them!
>
>    - Mike
>
____________________________________________________________________________
>   mike j. brown                   |  xml/xslt: http://skew.org/xml/
>   denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <xsl:stylesheet version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
>   <xsl:output method="html" indent="yes" />
>
>   <xsl:template match="/">
>     <html>
>       <head>
>         <style type="text/css">
>      p.page {page-break-after: always}
>      body {background-color:#cccccc; margin:0
>            font:MessageBox;
>            font:Message-Box;}
>     .TableBody {background: white;
>        font-family: arial;
>        font-size: 9px}
>     .TableHeading  {border-top-width:1;
>        border-left-width:1;
>        border-bottom-width:1;
>        border-right-width:1;
>        border-right-color:black;
>        border-bottom-color:black;
>        border-style:outset;
>        font-family:verdana;
>        font-size:10px;
>        background-color:#cccccc}
>         </style>
>         <!-- rest of head here -->
>       </head>
>       <body>
>         <xsl:apply-templates select="XMLData/Page" />
>       </body>
>     </html>
>   </xsl:template>
>
>   <xsl:template match="Page">
>     <p class="page">
>       <table style="background: black" cellspacing="1" width="600">
>         <thead>
>           <xsl:apply-templates select="Columns/Column" />
>         </thead>
>         <tbody class="TableBody">
>           <xsl:apply-templates select="People/Person" />
>         </tbody>
>       </table>
>     </p>
>   </xsl:template>
>
>   <xsl:template match="Column">
>     <th nowrap="yes" class="TableHeading">
>       <xsl:choose>
>         <xsl:when test="string(Caption)">
>           <xsl:value-of select="Caption" />
>         </xsl:when>
>         <xsl:otherwise>&#160;</xsl:otherwise>
>       </xsl:choose>
>     </th>
>   </xsl:template>
>
>   <xsl:template match="Person">
>     <tr>
>       <xsl:variable name="thisPerson" select="." />
>       <xsl:for-each select="../../Columns/Column">
>         <xsl:variable name="thisColumnData"
select="$thisPerson/Data/*[local-name()=current()/XMLNodeName]" />
>         <xsl:choose>
>           <xsl:when test="$thisColumnData">
>             <xsl:apply-templates select="$thisColumnData" />
>           </xsl:when>
>           <xsl:otherwise>
>             <td valign="top"
style="color:#000000;background-color:#FFFFFF">&#160;</td>
>           </xsl:otherwise>
>         </xsl:choose>
>       </xsl:for-each>
>     </tr>
>   </xsl:template>
>
>   <xsl:template match="A1|A2|A3|A4|A5|A6">
>     <xsl:variable name="color">
>       <xsl:if test="@color">
>         <xsl:value-of select="@color"/>
>       </xsl:if>
>     </xsl:variable>
>     <xsl:variable name="bgcolor">
>       <xsl:if test="@fond">
>         <xsl:value-of select="@fond"/>
>       </xsl:if>
>     </xsl:variable>
>     <td valign="top">
>       <xsl:attribute name="style">
>         <xsl:text>color:#</xsl:text>
>         <xsl:choose>
>           <xsl:when test="$color != ''">
>               <xsl:value-of select="$color"/>
>           </xsl:when>
>           <xsl:otherwise>000000</xsl:otherwise>
>         </xsl:choose>
>         <xsl:text>;background-color:#</xsl:text>
>         <xsl:choose>
>           <xsl:when test="$bgcolor != ''">
>               <xsl:value-of select="$bgcolor"/>
>           </xsl:when>
>           <xsl:otherwise>FFFFFF</xsl:otherwise>
>         </xsl:choose>
>         <xsl:text>;</xsl:text>
>       </xsl:attribute>
>       <xsl:choose>
>         <xsl:when test="string(.)">
>           <xsl:value-of select="." />
>         </xsl:when>
>         <xsl:otherwise>&#160;</xsl:otherwise>
>       </xsl:choose>
>     </td>
>   </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.