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(_at_)programmer(_dot_)net> wrote:
----- Original Message -----
From: "Chris Coyle" <chriscoyle(_at_)yahoo(_dot_)com>
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[(_at_)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[(_at_)name='CLASSIFICATION_ID']"/>
<xsl:apply-templates
select="//Transaction/Response/MasterCatalogRecord/EntityData[starts-with(Attribute[(_at_)name='CLASSIFICATION_ID'],$main_id)
and
string-length(Attribute[(_at_)name='CLASSIFICATION_ID'])
string-length($main_id)]"/>
--
___________________________________________________
Search for products and services at:
http://search.mail.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>
--~--
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
--~------------------------------------------------------------------
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>
--~--