xsl-list
[Top] [All Lists]

Re: key selecting problem.

2002-09-30 15:01:38
loebek:

At 05:41 PM 9/30/2002, you wrote:
I need to select the
/OfferPage/info/massnahmen/ratierliche/investitionen/massnahme/@haeufigkeit

when the value is 1 I need to get the "Monatlich" text out from another node. It correspondents with the
/OfferPage/output/massnahmen/ratierlich/intervall/intervall_item/@value

when 4 = Jährlich
and so on....


<OfferPage>
 <output>
  <massnahmen>
   <ratierlich>
    <intervall>
     <intervall_item value="1">Monatlich</intervall_item>
     <intervall_item value="2">Vierteljährlich</intervall_item>
     <intervall_item value="3">Halbjährlich</intervall_item>
     <intervall_item value="4">Jährlich</intervall_item>
    </intervall>
   </ratierlich>
  </massnahmen>
 </output>
</OfferPage>

It should something like:
<xsl:value-of select="key('intervall_by_id', @haeufigkeit)/??and?here???"/>

Try this:

<xsl:key name="intervall_item-by-value" match="intervall_item" use="@value"/>

Then simply

<xsl:template match="massnahme">
  ...
  <xsl:value-of select="key('intervall_item-by-value', @haeufigkeit)"/>
  ...
</xsl:template>

will get you the desired string (but note the context node must be your <massnahme> for the XPath '@haeufigkeit' to pick up the correct key ... if it is otherwise, you need a different XPath).

I hope that helps,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>