[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
RE: xsl:number problem
Charlene,
Could you please re-express this in natural language?
I suggest you do this by deleting your stylesheet from the post, giving us
the input and the output, and explaining in an English sentence (or a few
if necessary) what the relation is between your input and output. (It
hasn't been stated clearly and explicitly yet I don't think.)
Or you could use another natural language besides English, if you prefer
(although you might get fewer readers on the list). The reason I recommend
a natural language description is that it's an excellent first step to
writing a declarative transform (which is what you need).
Cheers,
Wendell
At 10:57 AM 6/18/2003, you wrote:
All,
Here is a complete example of what I want to do.
1. My xml looks like this:
<solution>
<product>
<productID>1</productId>
</product>
<product>
<productID>2</productId>
</product>
<program>
<product>
<productID>3</productId>
</product>
<product>
<productID>4</productId>
</product>
</program>
<product>
<productID>5</productId>
</product>
</solution>
2. My xsl looks like this:
<?xml version="1.0"?>
<!-- CVS $Id: page2xls.xsl,v 1.2 2003/05/07 04:57:13 vgritsenko Exp $ -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://apache.org/cocoon/SQL/2.0"
xmlns:gmr="http://www.gnome.org/gnumeric/v7" >
<xsl:param name="view-source"/>
<xsl:template match="solution">
<gmr:Workbook xmlns:gmr="http://www.gnome.org/gnumeric/v7">
<gmr:Sheets>
<gmr:Sheet DisplayFormulas="false" HideZero="false"
HideGrid="false" HideColHeader="false" HideRowHeader="false"
DisplayOutlines="true" OutlineSymbolsBelow="true" OutlineSymbolsRight="true">
<gmr:Name><xsl:value-of select="name"/></gmr:Name>
<gmr:MaxCol>17</gmr:MaxCol>
<gmr:Styles>
<gmr:StyleRegion startRow="0" endRow="0" startCol="0" endCol="5">
<gmr:Style HAlign="1" VAlign="4" WrapText="0" Orient="1"
Shade="2" Indent="0" Locked="1"
Hidden="0" Fore="0:0:0" Back="C0C0:C0C0:C0C0"
PatternColor="C0C0:C0C0:C0C0" Format="General">
<gmr:StyleBorder>
<gmr:Top Style="5"/>
<gmr:Bottom Style="0"/>
<gmr:Left Style="0"/>
<gmr:Right Style="0"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
<gmr:StyleRegion startRow="26" endRow="26" startCol="17" endCol="17">
<gmr:Style HAlign="8" VAlign="2" WrapText="0" Orient="1"
Shade="1" Indent="0" Locked="1"
Hidden="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF"
PatternColor="FFFF:FFFF:FFFF" Format="General">
<gmr:Font Unit="10" Bold="1" Italic="0" Underline="0"
StrikeThrough="0">Times New Roman</gmr:Font>
<gmr:StyleBorder>
<gmr:Top Style="1"/>
<gmr:Bottom Style="1"/>
<gmr:Left Style="0"/>
<gmr:Right Style="5"/>
<gmr:Diagonal Style="0"/>
<gmr:Rev-Diagonal Style="0"/>
</gmr:StyleBorder>
</gmr:Style>
</gmr:StyleRegion>
</gmr:Styles>
<gmr:Cols>
<gmr:ColInfo No="0" Unit="52"/>
<gmr:ColInfo No="1" Unit="42"/>
</gmr:Cols>
<gmr:Rows>
<gmr:RowInfo No="0" Unit="13.5"/>
<gmr:RowInfo No="1" Unit="13.5"/>
</gmr:Rows>
<gmr:Cells>
<gmr:Cell Col="16" Row="26" ValueType="60">
Price
</gmr:Cell>
<xsl:apply-templates/>
</gmr:Cells>
</gmr:Sheet>
</gmr:Sheets>
</gmr:Workbook>
</xsl:template>
<xsl:template match="content">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="productId">
<gmr:Cell Col="1" Row="27" ValueType="60">
<xsl:variable name="rownumber"><xsl:number level="any"
count="productId"/></xsl:variable>
<xsl:attribute name="Row">
<xsl:value-of select="position() + $rownumber + 2"/>
</xsl:attribute>
<gmr:Content>
<xsl:apply-templates/>
</gmr:Content>
</gmr:Cell>
<xsl:variable name="rownumber"><xsl:number level="any"
count="productId"/></xsl:variable>
<gmr:Cell Col="0" Row="27" ValueType="60">
<xsl:attribute name="Row">
<xsl:value-of select="27 + $rownumber + 2"/>
</xsl:attribute>
Comments
</gmr:Cell>
<gmr:Cell Col="3" Row="31" ValueType="60">
<xsl:attribute name="Row">
<xsl:value-of select="position() + $rownumber + 5"/>
</xsl:attribute>
IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED, SHADED,
FORMAT BOX ABOVE
</gmr:Cell>
</xsl:template>
</xsl:stylesheet>
3. The output from the above is like this:
1
2
3
4 IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED,
SHADED, FORMAT BOX ABOVE
5 IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED,
SHADED, FORMAT BOX ABOVE
Comments IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED,
SHADED, FORMAT BOX ABOVE
Comments IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED,
SHADED, FORMAT BOX ABOVE
Comments IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED,
SHADED, FORMAT BOX ABOVE
4. The output I am trying to have is like this:
1
2
3
4
5
Comments
IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED,
SHADED, FORMAT BOX ABOVE
Basically I have to know the total number of productIds in the
solution. I need to use the last number to position the cells following that.
THANKS!!!
Charlene
-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Wednesday, June 18, 2003 10:02 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: xsl:number problem
> I hope you can shed some light on what I did wrong. Please let me know
> if I haven't made myself clearer.
your messages are not clear at all.
You are showing fragments of code like this
<xsl:attribute name="Row">
which would generate an attribute, then claiming that the output is
The output is :
1
2
3
4
which is just text with no markup so it presumably isn't the output from
the stylesheet that you showed. As your XSl code is not doing what you
want, it would be more helpful not to show it as it just confuses the
issue.
Just give a small well formed XML example input and a small well formed
example XML desired output and describe what teh relation shoulkd be
then someone might have a chnance to help you.
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
"Thus I make my own use of the telegraph, without consulting
the directors, like the sparrows, which I perceive use it
extensively for a perch." -- Thoreau
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
- RE: xsl:number problem, (continued)
- Yan, Charlene - Wed, 18 Jun 2003 10:09:11 -0400 (EDT)
- Yan, Charlene - Wed, 18 Jun 2003 10:57:14 -0400 (EDT)
- Mike Brown - Wed, 18 Jun 2003 13:05:41 -0400 (EDT)
- Wendell Piez - Wed, 18 Jun 2003 13:31:15 -0400 (EDT) <=
- Michael Kay - Wed, 18 Jun 2003 14:27:37 -0400 (EDT)
- Yan, Charlene - Wed, 18 Jun 2003 12:52:39 -0400 (EDT)
- Yan, Charlene - Wed, 18 Jun 2003 13:05:49 -0400 (EDT)
|
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|