xsl-list
[Top] [All Lists]

Re: [xsl] Re: Identity Transform with special grouping

2011-02-05 14:40:05
Hi Martin,
Thank you for the quick solution.

Sen

On Sat, Feb 5, 2011 at 6:20 AM, Martin Honnen 
<Martin(_dot_)Honnen(_at_)gmx(_dot_)de> wrote:
Senthilukvelaan wrote:

"sections" element is not showing up in my output. I do not know , how
could I include that in my xslt.


Sorry, I did not notice.
You need to write a template for the parent element of "section" elements
then e.g.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

<xsl:param name="n" select="2"/>

<xsl:output method="xml" omit-xml-declaration="yes"  indent="yes"
encoding="UTF-8" />
<xsl:strip-space elements="*"/>

<xsl:template match="node() | @*">
 <xsl:copy>
   <xsl:apply-templates select="node()| @*"/>
 </xsl:copy>
</xsl:template>

<xsl:template match="*[section]">
 <xsl:copy>
   <xsl:apply-templates select="@*"/>
   <xsl:apply-templates select="section[1]/preceding-sibling::node()"/>
   <sections>
     <xsl:apply-templates select="section[position() &lt; $n]"/>
   </sections>
   <xsl:apply-templates select="section[last()]/following-sibling::node()"/>
 </xsl:copy>
</xsl:template>

</xsl:stylesheet>




--

       Martin Honnen
       http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>