xsl-list
[Top] [All Lists]

Re: [xsl] Problem with a key

2012-03-22 18:41:49
Yes it did, thank you very much!

Russ


On Thu, Mar 22, 2012 at 05:15:56PM -0400, G. Ken Holman wrote:
The use= attribute is calculated relative to the node matched.

You are matching on title so you need to express use= as relative to the 
title element.

BTW, the use of text() may happen to work but it is a bad habit to get 
into.  So very (very!) rarely have I ever needed to use text().  If you 
want the text value of an element, simply address the element.

I hope this helps.

. . . . . . . . Ken

At 2012-03-22 16:10 -0500, russurquhart1(_at_)verizon(_dot_)net wrote:
I am trying to use a key to return the errata_section title elements, 
given the device_name element attached to the parent errata_section.

The structure is like the following:

<errata_section>
  <title>Bug title 1</title>

  <devices_impacted>
     <device_name>Mod1</device_name>
  </devices_impacted>
  <devices_impacted>
     <device_name>Mod45</device_name>
  </devices_impacted>
,
,
,
</errata_section>

<errata_section>
.
.
.
</errata_section>

As several devices maybe addressed in a given errata_section element, i 
was trying to write a key to pull out, for a given device, ALL the 
errata_section titles that impact this device name. (Ideally for 
inclusion into a table based on the device name.

I wrote the following thinking this might work:

        <xsl:key name="bugtitlekey" match="errata_section/title"  
use="errata_section/devices_impacted/device_name" />
        <xsl:template match="/">
                <xsl:value-of select="key('bugtitlekey', 'Mod4')/text()"/>

        </xsl:template>

I don't get any output when i try this. I thought my key def was ok.  
Do i need to go deeper per each errata_section element?


--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/uoui9h
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   
mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--

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