[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Many Key values question

Subject: Re: Many Key values question
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 18 Oct 2014 06:51:05 -0000
Re:  Many Key values question
I don't see the usefulness of such key (if you can concatenate the
string value of the two elements, you certainly have them already.

But here is one way of constructing such key anyway:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" indent="yes"/>
  <xsl:key name="kX"
           match="datafield[@tag='773']/subfield[@code='5' or @code='t']"
           use="concat(../subfield[@code='5'], ../subfield[@code='t'])"/>

 <xsl:template match="datafield[@tag='773']">
   <xsl:copy-of select="key('kX', concat(subfield[@code='5'],
subfield[@code='t']))"/>
 </xsl:template>
</xsl:stylesheet>

When this transformation is applied on the provided source XML document:

<collection>
 <record>
  <datafield tag="773" ind1="0" ind2=" ">
   <subfield code="5">BULLETIN / EIDGENOESSISCHE TECHNISCHE HOCHSCHULE
ZUERICH </subfield>
   <subfield code="t">Bulletin / EidgenC6ssische Technische Hochschule
ZC<rich </subfield>
   <subfield code="d">ZC<rich : Schulleitung der ETH ZC<rich, 1993-2005
</subfield>
   <subfield code="g">S. 27-33</subfield>
  </datafield>
 </record>
</collection>

the wanted, correct result is produced:

<subfield code="5">BULLETIN / EIDGENOESSISCHE TECHNISCHE HOCHSCHULE
ZUERICH </subfield>
<subfield code="t">Bulletin / EidgenC6ssische Technische Hochschule
ZC<rich </subfield>

Cheers,
Dimitre

On Fri, Oct 17, 2014 at 10:55 PM, Jean-Pierre Lamon gipi@xxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
>
>
> Here is my XML
>
>
>
> <collection>
>
>   <record>
>
>     <datafield tag="773" ind1="0" ind2=" ">
>
>  <subfield code="5">BULLETIN / EIDGENOESSISCHE TECHNISCHE HOCHSCHULE
ZUERICH
> </subfield>
>
>  <subfield code="t">Bulletin / EidgenC6ssische Technische Hochschule
ZC<rich
> </subfield>
>
>  <subfield code="d">ZC<rich : Schulleitung der ETH ZC<rich, 1993-2005
> </subfield>
>
>  <subfield code="g">S. 27-33</subfield>
>
>  </datafield>
>
>   </record>
>
> </collection>
>
>
>
> I want to index in the same key
>
> subfield[@code=b5b] and subfield[@code=btb]
>
>
>
> Ibve tried this :
> <xsl:key name="idxrev" match="datafield[@tag=773]"
> use="concat(subfield[@code='5'],subfield[@code='t'])"/>
>
>
>
> To display the keys, I use this :
>
>
> <xsl:for-each select="record/datafield[@tag=773]">
>
>             <xsl:sort select="
> concat(subfield[@code='5'],subfield[@code='t'])"/>
>
>             <xsl:value-of select="key('idxrev',
> concat(subfield[@code='5'],subfield[@code='t']))"/>
>
>             <br/>
>
> </xsl:for-each>
>
>
>
> But all the subfields are in the key not only the subfields 5 and t.
>
> Returned key :
>
> BULLETIN / EIDGENOESSISCHE TECHNISCHE HOCHSCHULE ZUERICH Bulletin /
> EidgenC6ssische Technische Hochschule ZC<rich ZC<rich : Schulleitung der
ETH
> ZC<rich, 1993-2005 S. 27-33
>
>
>
> Thx
> JP
>
> XSL-List info and archive
> EasyUnsubscribe (by email)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.