Subject: [xsl] Issue with nested grouping From: Geert Bormans <geert@xxxxxxxxxxxxxxxxxxx> Date: Sun, 02 Dec 2007 12:49:44 +0100 |
I have been looking at this for too long now, and I am still not sure why this doesn't work
I have an XML (stripped down version of a word XML document) That requires (nested) grouping, based on the text content of some paragraphs.
<?xml version="1.0" encoding="UTF-8"?> <w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" > <w:body> <wx:sect> <wx:sub-section> <w:p> <w:r><w:t>Text before first pgroup</w:t></w:r> </w:p> <w:p> <w:r><w:t>[start pgroup id="43210023"</w:t></w:r> </w:p> <w:p> <w:r><w:t>First P in pgroup</w:t></w:r> </w:p> <w:p> <w:r><w:t>Second P in pgroup.</w:t></w:r> </w:p> <w:p> <w:r><w:t>[start pgroup id="54320024"</w:t></w:r> </w:p> <w:p> <w:r><w:t>P in nested pgroup</w:t></w:r> </w:p> <w:p> <w:r><w:t>[end pgroup id="54320024"</w:t></w:r> </w:p> <w:p> <w:r><w:t>First P after nested group</w:t></w:r> </w:p> <w:p> <w:r><w:t>[end pgroup id="43210023"</w:t></w:r> </w:p> <w:p> <w:r><w:t>In between</w:t></w:r> </w:p> <w:p> <w:r><w:t>Other In between</w:t></w:r> </w:p> <w:p> <w:r><w:t>[start pgroup id="43210025"</w:t></w:r> </w:p> <w:p> <w:r><w:t>[start pgroup id="54320026"</w:t></w:r> </w:p> <w:p> <w:r><w:t>Isolated nested pgroup</w:t></w:r> </w:p> <w:p> <w:r><w:t>[end pgroup id="54320026"</w:t></w:r> </w:p> <w:p> <w:r><w:t>[end pgroup id="43210025"</w:t></w:r> </w:p> </wx:sub-section> </wx:sect> </w:body> </w:wordDocument>
<?xml version="1.0" encoding="UTF-8"?> <w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" > <w:body> <wx:sect> <wx:sub-section> <w:p> <w:r><w:t>Text before first pgroup</w:t></w:r> </w:p> <pgroup id="43210023"> <w:p> <w:r><w:t>First P in pgroup</w:t></w:r> </w:p> <w:p> <w:r><w:t>Second P in pgroup.</w:t></w:r> </w:p> <pgroup id="54320024"> <w:p> <w:r><w:t>P in nested pgroup</w:t></w:r> </w:p> </pgroup> <w:p> <w:r><w:t>First P after nested group</w:t></w:r> </w:p> </pgroup> <w:p> <w:r><w:t>In between</w:t></w:r> </w:p> <w:p> <w:r><w:t>Other In between</w:t></w:r> </w:p> <pgroup id="43210025"> <pgroup id="54320026"> <w:p> <w:r><w:t>Isolated nested pgroup</w:t></w:r> </w:p> </pgroup> </pgroup> </wx:sub-section> </wx:sect> </w:body> </w:wordDocument>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xsl:stylesheet version="2.0" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:int="urn:internal:resulttree" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="node()"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates select="node()"></xsl:apply-templates> </xsl:copy> </xsl:template>
<xsl:template match="*[w:p/w:r[matches(w:t,$re-start)]]" > <xsl:copy> <xsl:copy-of select="@*"/> <xsl:call-template name="processGroups"> <xsl:with-param name="thisNodes" select="node()"/> </xsl:call-template> </xsl:copy> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Dumb Question - XML to XM, Mukul Gandhi | Thread | Re: [xsl] Issue with nested groupin, Florent Georges |
Re: [xsl] Dumb Question - XML to XM, Mukul Gandhi | Date | Re: [xsl] Using XSL to create inter, Martin Honnen |
Month |