RE: [xsl] FW: key, generate-id, ignoring my template

Subject: RE: [xsl] FW: key, generate-id, ignoring my template
From: "Laura Madonna" <Laura.Madonna@xxxxxxxxx>
Date: Mon, 22 Mar 2004 17:15:42 -0700
That did help, but now I am having trouble getting the children <covrg_desc> to print for each key row-plan_desc-page.
I am only getting the first instance of <covrg_desc> to print for each vBenePlan.
Thank you.
Laura

-----Original Message-----
From: Andreas L. Delmelle [mailto:a_l.delmelle@xxxxxxxxxx]
Sent: Monday, March 22, 2004 3:57 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] FW: key, generate-id, ignoring my template


> -----Original Message-----
> From: Laura Madonna [mailto:Laura.Madonna@xxxxxxxxx]
>
> (I have cut down the xsl and xml).
> The problem is, I don't think the template to match on "page" is working:
>
>

Hi,

No, actually, I believe your problem is the variable definitions.
They return you nodes from the whole document, instead of just the context
node...

It's ok (even obligatory) to have the *key* definitions as children of the
xsl:stylesheet, but you probably want to move the variable declarations into
the matching template, and while you're at it, go for compound keys, like

<xsl:key name="row-plan_desc-page" match="row"
         use="concat(ancestor::page/@name,
           ' ', plan_desc)" />
<xsl:key name="row-heading-page" match="row"
         use="concat(ancestor::page/@name,
           ' ', heading)" />

In combination with:

<xsl:template match="/form/page/pcp">
  <xsl:variable name="vBenePlan"
                select="row[generate-id() = generate-id(
                  key('row-plan_desc-page', concat(
                    ancestor::page/@name,' ',plan_desc)))]" />
  <xsl:variable name="vHeading"
                select="row[generate-id() = generate-id(
                  key('row-heading-page', concat(
                    ancestor::page/@name,' ',heading)))]" />
...

Hope this helps!

Cheers,

Andreas

Current Thread