- Where Developers Learn, Share, & Build Careers
I have several XML files from which I am trying to create WordML tablets. Each nodellist has several nodes, and I have to create a column for each column up to a maximum of 15 columns. However, if there is less than 15, then the column needs to be justified.
Template that node list:
& lt; Xsl: template match = "NodeList" & gt; & Lt; Xsl: each selection = "nodef" & gt; & Lt; Xsl: Sort Data-Type = "Number" = "@ Status" Order = "Ascending" /> & Lt; Xsl: Sort Data-Type = "Text" = "@Name" Order = "Ascent" /> & Lt; Xsl: variable name = "documentName" = "cocat (@ id, '_Nodes.xml')" /> & Lt; Xsl: Apply -Template Mode = Select "Sirenode" = "Document ($ documentName) / node" /> & Lt; / XSL: for-each & gt; & Lt; / XSL: Templates & gt; Template:
& lt; Xsl: Template Mode = "Sirenode" Match = "Node" & gt; & Lt ;! - Output The Node Table - As a template for each, the output table multiple times - & gt; & Lt; Xsl: call-template name = "surrnodtable" /> & Lt; / XSL: Templates & gt; Surrnodetable template (where I'm stuck):
& lt; Xsl: Template Name = "Simple Notetable" & gt; & Lt; W: tbl & gt; & Lt; W: tblPr & gt; & Lt; W: tblStyle w: val = "ReportTable1" /> & Lt; W: tblW w: type = "dxa" & gt; & Lt; Xsl: attribute name = "w: w" & gt; & Lt; Xsl: Select Value = "$ Landscape Widow" /> & Lt; / XSL: Specialty & gt; & Lt; / W: tblW & gt; & Lt; W: tblLayout w: type = "fixed" /> & Lt; / W: tblPr & gt; & Lt; W: tblGrid & gt; & Lt; W: gridCol> & Lt; Xsl: attribute name = "w: w" & gt; & Lt; Xsl: Select Value = "$ nodename wide" /> & Lt; / XSL: Specialty & gt; & Lt; / W: gridCol> & Lt; W: gridCol> & Lt; Xsl: attribute name = "w: w" & gt; & Lt; Xsl: Select Value = "$ Landscape Widow - $ Node Name Wide" /> & Lt; / XSL: Specialty & gt; & Lt; / W: gridCol> & Lt; / W: tblGrid & gt; & Lt; W: tr & gt; & Lt ;! - First line - & gt; & Lt; W: tc & gt; & Lt ;! - The first cell is empty so that vertically merged - & gt; & Lt; W: vmerge w: val = "restart" /> & Lt; W: p / & gt; & Lt; / W: tc & gt; & Lt ;! - How to add a column for each heap? - & gt; & Lt; Xsl: each selection = "node" & gt; & Lt; W: tc & gt; & Lt; W: p & gt; & Lt ;! - In the second cell is the name of the node (from the xml file) - & gt; & Lt; W: t & gt; & Lt; Xsl: Select the value = "node name" /> & Lt; / W: t & gt; & Lt; / W: p & gt; & Lt; / W: tc & gt; & Lt; / XSL: for-each & gt; & Lt; / W: tr & gt; & Lt; / W: tbl & gt; & Lt; / XSL: Templates & gt; Maybe I am completely wrong on this, but I have confused myself trying to get 1 table and then start for each loop. I am here. I am grateful for any advice / guidance.
The link provided by the forefather is the right direction, but I think it can also be simple.
& lt; Xsl: variable name = "max-col" & gt; & Lt; XSL: Select & gt; & Lt; Xsl: when test = "count (node)"; "15" & gt; 16 & lt; / Xsl: When & gt; & Lt; Xsl: otherwise & gt; & Lt; Xsl: Select the value = "Count (node) + 1" /> & Lt; / Xsl: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / XSL: variable & gt; & Lt ;! - Then only take the 'Max-call' nodes - & gt; & Lt; Xsl: each selection = "node [condition () & amp; lt; $ max-col]" & gt; & Lt ;! - ..... your code ....... - & gt; & Lt; / XSL: for-each & gt; Use the same variables for the header and the rows.
Comments
Post a Comment