Subject: RE: [xsl] Excel XML tranformation From: "bryan" <bry@xxxxxxxxxx> Date: Tue, 5 Nov 2002 18:04:10 +0100 |
Okay, I'm not gonna put a lot of thought into this cause I'm sort of sick(flue), and for the same reason I'm not gonna take the time to test it but the following should be pointing towards a solution(could be improved): <xsl:template match="Row"> <xsl:apply-templates select="Cell[1]"><xsl:with-param name="pos" select="1"/></xsl:apply-templates> </xsl:template> <xsl:template match="Cell"> <xsl:param name="pos"/> <xsl:variable name="outpos"><xsl:choose><xsl:when test="@ss:Index"><xsl:value-of select="@ss:Index"/></xsl:when><xsl:otherwise><xsl:value-of select="$pos"/></xsl:otherwise></xsl:choose></xsl:variable> <xsl:call-template name="cellmaker"><xsl:with-param name="pos" select="$pos"/></xsl:call-template> <cell> <xsl:apply-templates/> </cell> <xsl:apply-templates select="following-sibling::Cell[1]"><xsl:with-param name="pos" select="$outpos"/></xsl:apply-templates> </xsl:template> <xsl:template name="cellmaker"> <xsl:param name="pos"/> <xsl:if test="@ss:Index"><xsl:variable name="index" select="@ss:Index - $pos"/><cell/><xsl:if test="$index > 0"><xsl:call-template name="cellmaker"><xsl:with-param name="pos" select="$pos + 1"/></xsl:call-template></xsl:if> </xsl:if> </xsl:template> <xsl:template match="Data"> matching Data here </xsl:template> anyone that's not sick as a dog right now feel free to improve on that :) -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas V. Nielsen Sent: Tuesday, November 05, 2002 4:11 PM To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' Subject: RE: [xsl] Excel XML tranformation > here's an example where an empty cell comes in between full cells [SNIP] What I could see from that example is, that the empty cell number 7 is "missing" I know it *is* there because of the Index, like described below > Ss:Index is used to keep track of table structure. Try > ss:Cell[@ss:Index = '6']/Data But this only works if the cell actually have the Index set, that is not always. One way or another I could end up, with an Excel spreadsheet, where I neither can get a match for ss:Cell[6]/ss:Data or ss:Cell[@ss:Index = '6']/Data, even though the data is there. > >From the documentation: "Specifies the column index of this > cell within > the containing row. If this tag is not specified, the first > instance of > a Cell element within a row has an assumed Index="1". Each additional > Cell element has an assumed Index that is one higher. " This I already have figured out without reading it from the documentation ;) My originally request was to do what you describe below > This use of ss:Index, while irritating, also means that one > could make a > generic table handler which either placed cells in, or left them out, > dependant on parameters, etc. passed to the application. Actually, if anyone has an example of such a generic table handler I would very much like to see it. <Thomas/> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Excel XML tranformation, Thomas V. Nielsen | Thread | correction on Xslt example was RE: , bryan |
RE: RE: RE: [xsl] JavaScript proble, Passin, Tom | Date | correction on Xslt example was RE: , bryan |
Month |