[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Help parsing a node

Subject: RE: [xsl] Help parsing a node
From: Michele R Combs <mrrothen@xxxxxxx>
Date: Thu, 26 Apr 2012 19:49:50 +0000

OK, that fixed the error, thank you.

However, now when we get to <for-each select="$uniqueTypes">, nothing happens.
That is, where previously I would see each of these container types in my
output, I don't see anything.

-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
Sent: Thursday, April 26, 2012 3:39 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Help parsing a node


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"
*/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.


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.Honnen@xxxxxx]
> Sent: Thursday, April 26, 2012 1:48 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxxx
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

Current Thread