RE: [xsl] xsl:number problem

Subject: RE: [xsl] xsl:number problem
From: "Yan, Charlene" <Charlene.Yan@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Jun 2003 14:57:07 -0400
I think I know why you are confused about my question.  I am displaying in the spreadsheet some node values from the xml string and some static text added in the stylesheet.  The productId is from the xml string.  "Comments" and "IF XTREME INSTALLATION IS REQUIRED, CHECK THE REQUIRED, SHADED, FORMAT BOX ABOVE" are added in the stylesheet to be displayed on the spreadsheet.  They are not in the node tree.  Position of the static text cells are dynamically decided by the number of productIds in the tree.

Hope this explains it.

THANKS!

Charlene 



-----Original Message-----
From: Michael Kay [mailto:mhk@xxxxxxxxx]
Sent: Wednesday, June 18, 2003 2:28 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] xsl:number problem


Your template rule for the productID element is producing various
elements and attributes which for some reason you haven't shown us. Is
this perhaps because you are showing us what an HTML browser does with
your output?

The template rule for productID also produces three non-space text
nodes: one containing the number, one containing the string "Comment",
and one containing the string "IF XTREME INSTALLATION IS REQUIRED, CHECK
THE REQUIRED, SHADED, FORMAT BOX ABOVE". This doesn't relate well to
what you showed us.

I suspect that you are doing something to mangle the output of your
stylesheet once the transformation is complete, but I have no idea what.

Michael Kay


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Yan, Charlene
> Sent: 18 June 2003 15:57
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] xsl:number problem
> 
> 
> 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] 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
> 


 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