[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: building a hierarchical classification out of

Subject: Re: Re: building a hierarchical classification out of flat and redundant data
From: "Albert Juhé" <albertjuhe@xxxxxxxxx>
Date: Wed, 26 Jul 2006 15:09:26 +0200
subunit classification
Yes, I found this problem too.

<unit>
  <subunit/>
     <sub-subunit/>
     <sub-sub-subunit/>
</unit>

<unit>
  <subunit>
        <sub-subunit>
               <sub-sub-subunit>
                </sub-sub-subunit>
         </sub-subunit>
  </subunit>
</unit>

I ask myself if it would be possible to be generalized?
Creating a general template that resolve this common problem.
Always is the same, but with different name of tags.


2006/7/26, mnews-xsl@xxxxxx <mnews-xsl@xxxxxx>:
Albert Juhi wrote:
> Hi,
>
> I have been trying the code, and the output it's not that I expect
> because the tag subunit is identet inside another subunit like this
>
> </sub-sub-subunit>
> </sub-subunit>
> </sub-subunit>
> </sub-subunit>
> </sub-subunit>
> </sub-subunit>
> </sub-subunit>


> And there are duplicated nodes


The duplicated nodes could be explained if there are indeed
sub-sub-subunit's that are not preceeded by a matching sub-subunit,

I wrote templates that could point to this case, by showing the
preceeding subunit's:

<xsl:template match="/modul">
       <xsl:apply-templates/>
</xsl:template>

<xsl:template match="unit">
       <xsl:apply-templates select="subunit"/>
</xsl:template>

<xsl:template match="subunit">
       <xsl:apply-templates select="following-sibling::node()[1]"
mode="check"/>
</xsl:template>

<xsl:template match="node()" mode="check">
       <xsl:apply-templates select="following-sibling::node()[1]"
mode="check"/>
</xsl:template>

<xsl:template match="sub-sub-subunit" mode="check">
       <xsl:text>&#10;inproper nesting starting with node &#10;</xsl:text>
       <xsl:copy-of select="preceding-sibling::subunit[1]"/>
       <xsl:copy-of select="current()"/>
</xsl:template>

<xsl:template match="sub-subunit" mode="check"/>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.