|
Subject: Re: [xsl] XTTE1100: A sequence of more than one item is not allowed as the @group-adjacent attribute From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 13 May 2013 22:44:46 -0500 |
So here is the complete solution to this problem, using XSLT 3.0:
T:\ftemp>type ihe.xml <A> <!-- start group --> <B> <C/> <D/> </B> <B> <C/> <D/> </B> <!-- end group --> <B/> *** singleton group <C/> *** singleton group <!-- start group --> <D> <E/> <E> <F/> </E> </D> <D> <E/> <E> <F/> </E> </D> <!-- end group --> <!-- start group --> <B> <C/> <D/> </B> <B> <C/> <D/> </B> <!-- end group --> </A>
T:\ftemp>call xslt2 ihe.xml ihe.xsl
<group>
<B>
<C/>
<D/>
</B>
<B>
<C/>
<D/>
</B>
</group>
<group>
<B/>
</group>
<group>
<C/>
</group>
<group>
<D>
<E/>
<E>
<F/>
</E>
</D>
<D>
<E/>
<E>
<F/>
</E>
</D>
</group>
<group>
<B>
<C/>
<D/>
</B>
<B>
<C/>
<D/>
</B>
</group>T:\ftemp>type ihe.xsl <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:for-each-group select="*"
group-adjacent="string-join(descendant-or-self::*/
concat(local-name(),'$',count(ancestor::*)),' ')">
<group>
<xsl:sequence select="current-group()"/>
</group>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>
-- Contact us for world-wide XML consulting and instructor-led training | Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm | Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ | G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx | Google+ profile: https://plus.google.com/116832879756988317389/about | Legal business disclaimers: http://www.CraneSoftwrights.com/legal |
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] XTTE1100: A sequence of m, Dimitre Novatchev | Thread | [xsl] XPST0008: Error in use-when e, Andrew Welch |
| Re: [xsl] XTTE1100: A sequence of m, Dimitre Novatchev | Date | [xsl] XPST0008: Error in use-when e, Andrew Welch |
| Month |