Subject: Re: Sorting using more than value
From: Susan Bodnik <aquasue@xxxxxxxxx>
Date: Thu, 11 Nov 2010 14:24:15 -0800 (PST)
|
Wendell, thanks for your reply - much appreciated.
I made the following
change to the
template:<xsl:for-each-groupselect="//indexterm"group-by="(@term.entry,text()
[1])">
<xsl:sortselect="upper-case(current-grouping-key())"/>
<divclass="index">
<span>
<xsl:value-ofselect="current-grouping-key()"/>
<xsl:text> - </xsl:text>
</span>
</div>
</xsl:for-each-group>
The
transformation seems to find both the term.entry attribute and the indexterm
element content. Here is an example of the output:<div
<divclass="index"><span>weblink element - </span></div>
<divclass="index"><span>X title - </span></div> <!-- This is the term.entry
for
the indexterm that contains 'title'. -->
<divclass="index"><span>Y topic
- </span></div> <!-- This is the term.entry for
the indexterm that contains
'topic'. -->class="index"><span>Authentic -
</span></div>
<divclass="index"><span>elements - </span></div>
<divclass="index"><span>image
element - </span></div>
<divclass="index"><span>title - </span></div>
<divclass="index"><span>topic - </span></div>
<divclass="index"><span>W
elements - </span></div><!-- This is the term.entry
for the indexterm that
contains 'elements'. -->
The elements seem to output twice - once for the
element and once for the
attribute. What change would be needed for the
template to output only the
element or the attribute and not both?
Thanks
Susan
-----------------------------------------------------------------------------
---------------------------------
----- Original Message ----
From: Wendell
Piez <wapiez@xxxxxxxxxxxxxxxx>
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Sent: Thu,
November 11, 2010 4:06:45 PM
Subject: Re: Sorting using more than value
Susan,
At 03:46 PM 11/11/2010, you wrote:
>> I am having problems in sorting
using one of two possible values.I have a
>>template that creates an index
using the indexterm element. I need to be able
>>to sort the index using one
of two possible values. If the indexterm doesn't
>>contain a term.entry
attribute, it should sort using the content of the
>>indexterm element. If
the indexterm element contains a term.entry attribute,
>>then it should sort
using the value of the term.entry attribute.
>>
>> How would I be able to
sort the index entries using the content of the
indexterm element (when there
is no term.entry element) or the term.entry
attribute for the indexterm
element (if present)?
-----------------------------------------------------------------------------
------------------------------------------------
|