[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Define internal xsl variable
Hello, I'm Susanne and did already some xsl transformations before. For now I try to define an internal xsl variable but the xpath expression doesn't work so far. (The current xsl approach is shown below.) The 'origin' variable should be mapped into the following node set (in the 'spannedCells' variable): <t:data>1</t:data> <t:data>2 3</t:data> <t:data>4 5 6</t:data> <t:data>7</t:data> It shows occupied cells including the "spanned" ones. I think that some recursive design should be possible but I just didn't find how to start in this case. I would be very glad about any hint. Full xsl file follows: ------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="http://www.example.org/test" version="2.0"> <xsl:template name="main"> <xsl:variable name="origin" as="node()*"> <t:cell>foo</t:cell> <t:cell span="2">bar</t:cell> <t:cell span="3">baz</t:cell> <t:cell>test</t:cell> </xsl:variable> <xsl:variable name="SpannedCells" as="node()*"> <t:data>1</t:data> <xsl:for-each select="$origin[position() > 1]"> <xsl:variable name="PreviousValue" select="xs:integer(max(preceding::t:data/text()))"/> <xsl:variable name="MaxValue" select="if (./@span) then ($PreviousValue + 1 + @span) else ($PreviousValue + 1)"/> <t:data> <xsl:value-of select="($PreviousValue + 1) to $MaxValue"/> </t:data> </xsl:for-each> </xsl:variable> <xsl:message select="$SpannedCells"/> </xsl:template> </xsl:stylesheet> ------------------------------------------------------------------------ Thanks and kind regards... Susanne
|
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
|