Re: [xsl] xsl:key() and $variables.

Subject: Re: [xsl] xsl:key() and $variables.
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 20 Jul 2006 17:34:54 -0400
At 2006-07-20 15:41 -0400, Steve wrote:
I have a variable containing
and some xml (document('../blah.xml') containing...

It would help next time if you could supply the code that you already have so that it takes less time for others to modify it.

How do I  <xsl:apply-templates select="$variable/Records/Record[1]" />
only those records which are neccesary="yes"  ?

I'm not sure what you are asking, are you asking what principles to use, or are you asking someone to supply you with an answer? Below is an answer, though I'm not sure what aspect of the problem you are having issues with that caused you to ask the question to the list.

I hope this helps.

. . . . . . . . . . Ken

t:\ftemp>type blah.xml
<?xml version="1.0" encoding="US-ASCII"?>
  <activity necessary="no">Baseball</activity>
  <activity necessary="no">Shopping</activity>
  <activity necessary="yes">Writing</activity>

t:\ftemp>type steve3.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="";

<xsl:output method="text"/>

<xsl:key name="activities" match="activity" use="@necessary"/>
<xsl:key name="records" match="Record" use="activity"/>

<xsl:template match="/">
  <xsl:variable name='records'>


<xsl:template match="Record">
  <xsl:value-of select="'Activity: ',activity,', hours=',hours"

t:\ftemp>xslt2 steve3.xsl steve3.xsl con
Activity: Writing, hours=3


Registration open for UBL training:    Montrial, Canada 2006-08-07
Also for XSL-FO/XSLT training:    Minneapolis, MN 2006-07-31/08-04
Also for UBL/XML/XSLT/XSL-FO training: Varo,Denmark 06-09-25/10-06
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05
Legal business disclaimers:

Current Thread