View Single Post
  #2 (permalink)  
Old January 14th, 2011, 12:33 PM
Martin Honnen Martin Honnen is offline
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Let's try to identify sub problems and solve them. You say you need special treatment for the "slot" elements inside the "slots" elements of "pagelet-component" and want to sort the "slot" elements according to the "definition-name". That could be achieved with
Code:
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:impex="http://www.x.com/xml/ns/xXx/6.5/bc_pmc/impex"
  version="1.0">
  
  <xsl:strip-space elements="*"/>
  <xsl:output indent="yes"/>
  
  <xsl:template match="@* | text() | comment() | processing-instruction()">
    <xsl:copy/>
  </xsl:template>
  
  <xsl:template match="*[*]">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates select="*">
        <xsl:sort select="local-name()" data-type="text"/>
        <xsl:sort select="@id" data-type="text"/>
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>
  
  <xsl:template match="*[not(*)]">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  
  <xsl:template match="impex:pagelet-component/impex:slots" priority="5">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates select="impex:slot">
        <xsl:sort select="impex:definition-name"/>
      </xsl:apply-templates>
    </xsl:copy>
  </xsl:template>  

</xsl:stylesheet>
Does that do what you want for those "slot" elements?
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote