Subject: [xsl] Converting a node tree to a textual representation From: "Houghton,Andrew" <houghtoa@xxxxxxxx> Date: Sun, 3 Sep 2006 01:17:53 -0400 |
I'm using XSL 2.0 to create a CSV text file. One of the columns needs to be a textual representation of a portion of the source document. The source document looks something like: <doc> <lvl> <rec> <sect1/> <sect2/> <sect3/> </rec> <rec> <sect1/> <sect2/> <sect3/> </rec> <rec> <sect1/> <sect2/> <sect3/> </rec> </lvl> </doc> The CSV is suppose to look something like: col1value,col2value,<rec><sect1/><sect2/><sect3/></rec> col1value,col2value,<rec><sect1/><sect2/><sect3/></rec> col1value,col2value,<rec><sect1/><sect2/><sect3/></rec> The last column contains the textual representation of each of the <rec> nodes in the source document. Building the CSV structure is simple, but I haven't quite figured out an easy way to convert the <rec> nodes in the tree to their textual representation. So I have some XSL that looks like: <xsl:for-each select="rec"> <xsl:variable name="col1" as="xsd:string" select="string('col1value')"/> <xsl:variable name="col2" as="xsd:string" select="string('col2value')"/> <xsl:variable name="col3" as="element()" select="."/> <xsl:value-of select="concat($col1,$col2,$col3,' ')"/> </xsl:for-each> Obviously, that variable for col3 doesn't make it happen. Does anyone know of an easy way to do this without writing a recursive template that goes through the entire <rec> node set, which happens to have quite a bit of structure depth under each sect* elements? BTW, I do realize that the column values will need to be properly quoted and escaped, but that is an issue I have already solved and left out of the XSL to simplify the explanation of the problem. Thanks, Andy.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Confirmimg - Bug in Acces, Dimitre Novatchev | Thread | RE: [xsl] Converting a node tree to, Michael Kay |
Re: [xsl] Confirmimg - Bug in Acces, Dimitre Novatchev | Date | RE: [xsl] Converting a node tree to, Michael Kay |
Month |