xsl-list
[Top] [All Lists]

Re: [xsl] Help parsing a node

2012-04-26 16:27:55
Michele,

Martin wrote "xsl:key", but for whatever reason his fingers seem to have typed "xsl:name". Try what he meant to say and it should work.

If you aren't familiar with keys and how powerful and useful they are, now is a good moment to learn. One of their several uses is in getting around scaling problems when grouping (or doing any handling of unique values) in XSLT 1.0.

Also ... your diagnosis is not *quite* correct yet:

<xsl:variable name="uniqueTypes"
select="ead/archdesc/dsc/descendant::*/container[not(@type=following::
*/container/@type)]/@type" />

With the root node as context, this is selecting all container elements in descendants of /ead/archdesc/dsc whose type is not the same as that of a container *child* of a following element.

So, while following siblings are indeed found on the following:: axis, this in fact is checking elements against nieces (and/or nephews) or cousins (at various removes), but not against siblings.

Cheers,
Wendell

On 4/26/2012 2:15 PM, Michele R Combs wrote:
Do I put this at the top, where it is now?  I tried it there and it tells me

Element:<xsl:name>  must not appear directly within xsl:stylesheet

(Sorry if this should be obvious...)

-----Original Message-----
From: Martin Honnen [mailto:Martin(_dot_)Honnen(_at_)gmx(_dot_)de]
Sent: Thursday, April 26, 2012 1:48 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Help parsing a node

Michele R Combs wrote:
Pretty sure they're using 1.0 but I can check.

Define a key

<xsl:name name="uniqueTypesKey"
match="ead/archdesc/dsc/descendant::*/container"
use="@type" />

and then the variable as

<xsl:variable name="uniqueTypes"
select="ead/archdesc/dsc/descendant::*/container[generate-id() = 
generate-id(key('uniqueTypesKey', @type)[1])]"/>





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