[xsl] Using for-each-group out of word.xml

Subject: [xsl] Using for-each-group out of word.xml
From: Jeff Wilson <jeffrey@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 2 Aug 2011 06:43:59 -0700
Good Morning,

After a few tries, I was able to get the features grouped with
xsl:for-each-group using the following template:

<xsl:template match="/pkg:package/pkg:part/pkg:xmlData/w:document/
w:body" name="Features">
<xsl:for-each-group select="w:p/w:pPr/w:pStyle/@w:val[starts-with
(.,'Feature')]/ancestor::w:p" group-starting-with="w:p[w:pPr/w:pStyle/
@w:val='FeatureType']">
	<xsl:element name="AnchoredFeature">
		<xsl:attribute name="aid:pstyle" select="'_AnchoredFeature'"/>
		<xsl:for-each select="current-group()">
		...
	</xsl:element>
</xsl:for-each-group>
</xsl:template>

I think though, that I might not be able to keep them in document
order with the other w:body/w:p, since the w:body is a parent to all
the w:p nodes. The processor will always match the w:body element
first, make the feature groups and then format the other w:p as it
matches those.

Have I erred?

Here is the example xml:

<w:body>
...
<w:p w:rsidR="006B72DB" w:rsidRPr="00862900"
w:rsidRDefault="006B72DB" w:rsidP="006B72DB">
<w:pPr>
<w:pStyle w:val="FeatureType"/>
</w:pPr>
<w:proofErr w:type="gramStart"/>
<w:r>
<w:t>t</w:t>
</w:r>
<w:r w:rsidRPr="00862900">
<w:t>ype</w:t>
</w:r>
<w:proofErr w:type="gramEnd"/>
<w:r w:rsidRPr="00862900">
<w:t>=general</w:t>
</w:r>
</w:p>
<w:p w:rsidR="006B72DB" w:rsidRDefault="006B72DB" w:rsidP="006B72DB">
<w:pPr>
<w:pStyle w:val="FeatureTitle"/>
</w:pPr>
<w:r>
<w:lastRenderedPageBreak/>
<w:t>What Do I Type?</w:t>
</w:r>
<w:bookmarkStart w:id="0" w:name="_GoBack"/>
<w:bookmarkEnd w:id="0"/>
</w:p>
<w:p w:rsidR="006B72DB" w:rsidRDefault="006B72DB" w:rsidP="006B72DB">
<w:pPr>
<w:pStyle w:val="FeaturePara"/>
</w:pPr>
<w:r>
<w:t>With Tooltip Assistance set to at least Minimal, you can see the
keyboard shortcut for a tool by hovering your mouse pointer over it.
The keyboard shortcut is shown in parentheses next to the name of the
tool.</w:t>
</w:r>
</w:p>
...
</w:body>

Jeff Wilson,
neophyte

oXygen 8  Saxon8B  XSLT 2.0

Current Thread