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

Re: Creating a classification hierarcy by using XSLT t

Subject: Re: Creating a classification hierarcy by using XSLT to nest similarly named elements
From: Chris Coyle <chriscoyle@xxxxxxxxx>
Date: Sat, 20 Jan 2007 05:17:18 -0800 (PST)
Re:  Creating a classification hierarcy by using XSLT t
Thanks, Thomas.  This is almost exactly what I need.

Since "CATEGORY" will always be the most general (or
root level) in my classification scheme, my
<xsl:template match="EntityData"> needs to be more
speicific.  I believe I should only match when
<xsl:template match="EntityData"> AND <Attribute
name="CLASSIFICATION_LEVEL" type="string"> is equal to
"CATEGORY".

Can you tell me how to express this?

Gratefully,
Chris


--- Thomas Stone <tjbooker@xxxxxxxxxxxxxx> wrote:

> > ----- Original Message -----
> > From: "Chris Coyle" <chriscoyle@xxxxxxxxx>
> > So far, I have the following for my XSLT
> stylesheet:
> 
> >       <xsl:apply-templates
> select="//Transaction/Response"/>
> ...
> >   <xsl:template match="Response">
> >    <xsl:for-each
> select="MasterCatalogRecord/EntityData">
> 
>    Thanks for you question.  It would seem that you
> are looking for the EntityData records and not the
> Response records.  Using a template to respond to
> that particular record will be clearer.
> 
>    <xsl:apply-templates
>
select="//Transaction/Response/MasterCatalogRecord/EntityData">
> ...
> <xsl:template match="EntityData"> 
> 
> 
> > In order to achieve the nesting of elements I
> desire,
> > I believe I need to use recursion.  I just don't
> know
> > how to express it im my stylesheet.  Any
> suggestions
> > will be greatly appreciated.
> 
> 
>    This looks similar to a "self-join" database
> query.  You are selecting a main EntityData record
> and displaying it then finding that record's
> sub-EntityData record.  This would be much more
> efficient pulling from a database with indexes than
> after-the-fact in XML.  But that's a different
> forum;-)
> 
>    Your recursion is apparently one level deep, but
> the template doesn't have to know that!  Your
> apply-templates query needs to select your main
> records that do not have any parent-EntityData
> records.  I assume that this would be the
> CLASSIFICATION_ID Attribute entities with only a
> two-character string.
> 
> <xsl:apply-templates
>
select="//Transaction/Response/MasterCatalogRecord/EntityData[string-length(Attribute[@name='CLASSIFICATION_ID'])=2]"/>
> 
> 
>    Within your template, which now matches
> "EntityData", you will open the record tag and put
> out attributes to it.  Then, before you close the
> record tag, insert the following two lines to select
> this record's sub-EntityData records.
> 
> <xsl:variable name="main_id"
> select="Attribute[@name='CLASSIFICATION_ID']"/>
>         
> <xsl:apply-templates
>
select="//Transaction/Response/MasterCatalogRecord/EntityData[starts-with(Attribute[@name='CLASSIFICATION_ID'],$main_id)
> and
> string-length(Attribute[@name='CLASSIFICATION_ID'])
> > string-length($main_id)]"/>
> 
> 
> 
> -- 
> ___________________________________________________
> Search for products and services at:
> http://search.mail.com
> 
> 



 
____________________________________________________________________________________
It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

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-2007 All Rights Reserved.