Michele,
On 4/26/2012 3:49 PM, Michele R Combs wrote:
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.
Interesting. To solve this, keep in mind that $uniqueTypes is actually
bound to a set of nodes, each one working to represent all nodes of its
type.
There is one difference between the earlier code and the approach Martin
suggested, which might account for your problem. The code you received
counts a container as representative for its type if no container is
found following it with the same type (making allowances for the bugs
you discovered).
This means it is the last of its type, while the more conventional thing
(and what Martin provided) includes each container that is the first of
its type.
Look in your for-each and see whether that might be affecting things.
It's also possible to bind each container that is the last of its type
to a variable, if you really want to do that. But unless there's a
reason, you should prefer to use the first if only because that's what
those who come after you will want to see.
Cheers,
Wendell
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>
--~--
--~------------------------------------------------------------------
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>
--~--
--
======================================================================
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>
--~--