[xsl] Attribute filtering problems

Subject: [xsl] Attribute filtering problems
From: Mike Ferrando <mikeferrando@xxxxxxxxx>
Date: Wed, 18 Dec 2002 09:15:18 -0800 (PST)
Dear Friends,
I am have a brain block on this one. All I want to do is to filter
and sort certain attributes of an XML document. However, I am not
getting all the attributes. I have tried a number of different ways
to approach the attribute value but still can't get a filter out the
dups.

Thanks,
Mike Ferrando
Washington, DC

===XML===
<?xml version="1.0" encoding="utf-8" standalone="no"?>

<ICONOGRAPHY ID="CL1012" CTS_B="348-352" PS="1">
<Photographs_People ID="CL10121001" CTS_B="348-349, 352" PS="1"
C_TXT="Photographs--People">
  <C1 PS="15"><D1 PS="15">Slonimsky Family</D1>
    <C2 PS="1"><D2 PS="1" CT_B="348">Epstein, Yodel</D2></C2>
    <C2 PS="2"><D2 PS="2" CT_B="348">Slonimsky, Alexander</D2></C2>
    <C2 PS="3"><D2 PS="3" CT_B="348">Slonimsky, Alexander and
family</D2></C2>
    <C2 PS="4"><D2 PS="4" CT_B="348">Slonimsky, Alexander and
Lida</D2></C2>
    <C2 PS="5"><D2 PS="5" CT_B="348">Slonimsky, Alexander and Semen
Lensky</D2></C2>
    <C2 PS="6"><D2 PS="6" CT_B="348">Slonimsky, Alexander and
Vladimir</D2></C2>
    <C2 PS="7"><D2 PS="7" CT_B="348">Slonimsky, Mr. and Mrs.
Antoni</D2></C2>
    <C2 PS="8"><D2 PS="8" CT_B="348">Slonimsky, Electra</D2></C2>
    <C2 PS="9"><D2 PS="9" CT_B="348">Slonimsky, Faina</D2></C2>
    <C2 PS="10"><D2 PS="10" CT_B="348">Slonimsky, L. Z. (Kiev
1870)</D2></C2>
    <C2 PS="11"><D2 PS="11" CT_B="348">Slonimsky, Lida</D2></C2>
    <C2 PS="12"><D2 PS="12" CT_B="348">Slonimsky, Lida and
Vladimir</D2></C2>
    <C2 PS="13"><D2 PS="13" CT_B="348">Slonimsky, Mikhail</D2></C2>
    <C2 PS="14"><D2 PS="14" CT_B="348">Slonimsky, Mikhail and
"Dubia"</D2></C2>
    <C2 PS="15"><D2 PS="15" CT_B="348">Slonimsky, Nicolas</D2></C2>
    <C2 PS="16"><D2 PS="16" CT_B="348">Slonimsky, Nicolas and
Electra</D2></C2>
    <C2 PS="17"><D2 PS="17" CT_B="348">Slonimsky, Nicolas and Hans
Heinsheimer[?]</D2></C2>
    <C2 PS="18"><D2 PS="18" CT_B="348">Slonimsky, Nicolas and Yefim
Bronfman</D2></C2>
    <C2 PS="19"><D2 PS="19" CT_B="348">Slonimsky, Nicolas and
others</D2></C2>
    <C2 PS="20"><D2 PS="20" CT_B="348">Slonimsky, Nicolas and
unidentified</D2></C2>
    <C2 PS="21"><D2 PS="21" CT_B="348">Slonimsky, Raya</D2></C2>
    <C2 PS="22"><D2 PS="22" CT_B="348">Slonimsky, Vladimir</D2></C2>
    <C2 PS="23"><D2 PS="23" CT_B="348">Teri and Mara</D2></C2>
    <C2 PS="24"><D2 PS="24" CT_B="348">Mara</D2></C2>
    <C2 PS="25"><D2 PS="25" CT_B="348">[Unidentified
relative?]</D2></C2>
    <C2 PS="26"><D2 PS="26" CT_B="348">Vengerova,
Isabelle</D2></C2></C1>
  <C1 PS="16"><D1 PS="16">Others</D1>
    <C2 PS="27"><D2 PS="27" CT_B="348">Akses, Necil
K&amp;#_229;zim</D2></C2>
    <C2 PS="28"><D2 PS="28" CT_B="348">Albeniz, Isaac</D2></C2>
    <C2 PS="29"><D2 PS="29" CT_B="348">Alderighi, Dante</D2></C2>
    <C2 PS="30"><D2 PS="30" CT_B="348">Alexandrov, Anatoli</D2></C2>
    <C2 PS="31"><D2 PS="31" CT_B="348">Andriessen, Hendrik</D2></C2>
    <C2 PS="32"><D2 PS="32" CT_B="348">Arensky, Anton</D2></C2>
    <C2 PS="33"><D2 PS="33" CT_B="348">Arne, Thomas</D2></C2>
    <C2 PS="34"><D2 PS="34" CT_B="348">Auber, Daniel</D2></C2>
    <C2 PS="35"><D2 PS="35" CT_B="348">Auer, Leopold</D2></C2>
    <C2 PS="36"><D2 PS="36" CT_B="348">Auric, Georges</D2></C2>
    <C2 PS="37"><D2 PS="37" CT_B="348">Bacewicz,
Gra&amp;#_380;yna</D2></C2>
    <C2 PS="38"><D2 PS="38" CT_B="348">Bach, Johann Sebastian
(skull)</D2></C2>
    <C2 PS="39"><D2 PS="39" CT_B="348">Bachmann, Alberto</D2></C2>
    <C2 PS="40"><D2 PS="40" CT_B="348">Bacon, Ernst</D2></C2>
    <C2 PS="41"><D2 PS="41" CT_B="348">Baird, Tadeusz</D2></C2>
    <C2 PS="42"><D2 PS="42" CT_B="348">Barber, Samuel</D2></C2>
    <C2 PS="43"><D2 PS="43" CT_B="348">Barrios, Angel</D2></C2>
    <C2 PS="44"><D2 PS="44" CT_B="348">Barrueco, Manuel</D2></C2>
    <C2 PS="45"><D2 PS="45" CT_B="348">Barth, Hans and George
Gershwin</D2></C2>
    <C2 PS="46"><D2 PS="46" CT_B="348">Bart&amp;#_243;k,
B&amp;#_233;la</D2></C2>
    <C2 PS="47"><D2 PS="47" CT_B="348">Becker, John</D2></C2>
    <C2 PS="48"><D2 PS="48" CT_B="348">Beethoven, Ludwig van
(skull)</D2></C2>
    <C2 PS="49"><D2 PS="49" CT_B="348">Beethoven, Ludwig van (with F.
Liszt)</D2></C2>
    <C2 PS="50"><D2 PS="50" CT_B="348">Bely, Victor</D2></C2>
    <C2 PS="51"><D2 PS="51" CT_B="348">Berlioz, Hector</D2></C2>
    <C2 PS="52"><D2 PS="52" CT_B="348">Bernstein, Leonard</D2></C2>
    <C2 PS="53"><D2 PS="53" CT_B="348">Biriukov, Yuri</D2></C2>
    <C2 PS="54"><D2 PS="54" CT_B="348">Bonnazzi, Elaine</D2></C2>
    <C2 PS="55"><D2 PS="55" CT_B="348">Brahms, Johannes (death
bed)</D2></C2>
    <C2 PS="56"><D2 PS="56" CT_B="348">Bull, Ole</D2></C2>
    <C2 PS="57"><D2 PS="57" CT_B="348">Burton, John</D2></C2>
    <C2 PS="58"><D2 PS="58" CT_B="348">Cage, John</D2></C2>
    <C2 PS="59"><D2 PS="59" CT_B="348">Carrillo, Julian</D2></C2>
    <C2 PS="60"><D2 PS="60" CT_B="348">Casals, Pablo and Albert
Schweitzer</D2></C2>
    <C2 PS="61"><D2 PS="61" CT_B="348">Casella, Alfredo</D2></C2>
    <C2 PS="62"><D2 PS="62" CT_B="348">Casella, Alfredo (with
Ottorino Respighi)</D2></C2>
    <C2 PS="63"><D2 PS="63" CT_B="348">Castagnone, Riccardo</D2></C2>
    <C2 PS="64"><D2 PS="64" CT_B="348">Ceccato, Aldo</D2></C2>
    <C2 PS="65"><D2 PS="65" CT_B="348">Cerha, Friedrich</D2></C2>
    <C2 PS="66"><D2 PS="66" CT_B="348">Chabrier, Emmanuel</D2></C2>
    <C2 PS="67"><D2 PS="67" CT_B="348">Christou, Jani (and with
Robert Graves)</D2></C2>
    <C2 PS="68"><D2 PS="68" CT_B="348">Clementi, Muzio</D2></C2>
    <C2 PS="69"><D2 PS="69" CT_B="348">Copley, Michael (with Dag
Ingram)</D2></C2>
    <C2 PS="70"><D2 PS="70" CT_B="348">Corelli, Arcangelo</D2></C2>
    <C2 PS="71"><D2 PS="71" CT_B="348">Cras, Jean</D2></C2>
    <C2 PS="72"><D2 PS="72" CT_B="348">Cross, Gregory and Karen
(children of Lowell Cross)</D2></C2>
    <C2 PS="73"><D2 PS="73" CT_B="348">Cui, Cesar</D2></C2>
    <C2 PS="74"><D2 PS="74" CT_B="348">Cummings, Kathi</D2></C2>
    <C2 PS="75"><D2 PS="75" CT_B="348">D'Albert,
Eug&amp;#_232;ne</D2></C2>
    <C2 PS="76"><D2 PS="76" CT_B="348">Dallapiccola, Luigi</D2></C2>
    <C2 PS="77"><D2 PS="77" CT_B="348">Davidovich, Bella</D2></C2>
    <C2 PS="78"><D2 PS="78" CT_B="348">Debussy, Claude</D2></C2>
    <C2 PS="79"><D2 PS="79" CT_B="348">Dello Joio, Norman</D2></C2>
    <C2 PS="80"><D2 PS="80" CT_B="348">Dittrich, Paul-Heinz</D2></C2>
    <C2 PS="81"><D2 PS="81" CT_B="348">Dresden, Sem</D2></C2>
    <C2 PS="82"><D2 PS="82" CT_B="348">Dunayevsky, Isaak</D2></C2>
    <C2 PS="83"><D2 PS="83" CT_B="348">Dzerzhinsky, Ivan</D2></C2>
    <C2 PS="84"><D2 PS="84" CT_B="348">Eder, Helmut</D2></C2>
    <C2 PS="85"><D2 PS="85" CT_B="348">Egge, Klaus</D2></C2>
    <C2 PS="86"><D2 PS="86" CT_B="348">Ellis, Steve</D2></C2>
    <C2 PS="87"><D2 PS="87" CT_B="348">Emmanuel, Maurice</D2></C2>
    <C2 PS="88"><D2 PS="88" CT_B="348">Enesco, Georges</D2></C2>
    <C2 PS="89"><D2 PS="89" CT_B="348">Eshpai, Yakov</D2></C2>
    <C2 PS="90"><D2 PS="90" CT_B="348">Feinberg, Samuel</D2></C2>
    <C2 PS="91"><D2 PS="91" CT_B="348">Fere, Vladimir</D2></C2>
    <C2 PS="92"><D2 PS="92" CT_B="348">Gabrilowitsch, Ossip</D2></C2>
    <C2 PS="93"><D2 PS="93" CT_B="348">Gailhard, Pierre</D2></C2>
    <C2 PS="94"><D2 PS="94" CT_B="348">Garofalo, Carlo
Giorgio</D2></C2>
    <C2 PS="95"><D2 PS="95" CT_B="348">Gaubert, Philippe</D2></C2>
    <C2 PS="96"><D2 PS="96" CT_B="348">Gavazzeni,
Gianandrea</D2></C2>
    <C2 PS="97"><D2 PS="97" CT_B="348">Gbeho, Philip</D2></C2>
    <C2 PS="98"><D2 PS="98" CT_B="348">Getty, Gordon</D2></C2>
    <C2 PS="99"><D2 PS="99" CT_B="348">Glinka, Mikhail</D2></C2>
    <C2 PS="100"><D2 PS="100" CT_B="348">Gluck, Christoph
Willibald</D2></C2>
    <C2 PS="101"><D2 PS="101" CT_B="348">Gnessin, Mikhail</D2></C2>
    <C2 PS="102"><D2 PS="102" CT_B="348">Goedicke,
Alexander</D2></C2>
    <C2 PS="103"><D2 PS="103" CT_B="348">Golubev, Evgeni</D2></C2>
    <C2 PS="104"><D2 PS="104" CT_B="348">Gorini, Gino</D2></C2>
    <C2 PS="105"><D2 PS="105" CT_B="348">Gould, Morton</D2></C2>
    <C2 PS="106"><D2 PS="106" C11="see also: Photographs--People BOX
352" X_TARGET="CL10121001BOX352" CT_B="348">Gounod, Charles</D2></C2>
    <C2 PS="107"><D2 PS="107" CT_B="348">Gradstein, Alfred</D2></C2>
    <C2 PS="108"><D2 PS="108" CT_B="348">Green, John</D2></C2>
    <C2 PS="109"><D2 PS="109" CT_B="348">Gretchaninov,
Alexander</D2></C2>
    <C2 PS="110"><D2 PS="110" CT_B="348">Gr&amp;#_233;try,
Andr&amp;#_233;</D2></C2>
    <C2 PS="111"><D2 PS="111" CT_B="348">Grieg, Edvard</D2></C2>
    <C2 PS="112"><D2 PS="112" CT_B="348">Guba, V[ladimir] (with Igor
Blazhkov, L. Grabovski, and [V.] Silvestrov)</D2></C2>
    <C2 PS="113"><D2 PS="113" CT_B="348">G&amp;#_252;rsching,
Albrecht</D2></C2>
    <C2 PS="114"><D2 PS="114" CT_B="349">Haba, Alois</D2></C2>
    <C2 PS="115"><D2 PS="115" CT_B="349">Harris, Roy</D2></C2>
    <C2 PS="116"><D2 PS="116" CT_B="349">Hartmann [Gartman],
V[ictor]</D2></C2>
    <C2 PS="117"><D2 PS="117" CT_B="349">Haydn, Joseph</D2></C2>
    <C2 PS="118"><D2 PS="118" CT_B="349">Herz, Henri</D2></C2>
    <C2 PS="119"><D2 PS="119" CT_B="349">Hilsberg, Ignace</D2></C2>
    <C2 PS="120"><D2 PS="120" CT_B="349">Hill, Edward
Burlingame</D2></C2>
    <C2 PS="121"><D2 PS="121" CT_B="349">Hofmann, Josef</D2></C2>
    <C2 PS="122"><D2 PS="122" CT_B="349">Kassyanik, Uri
(Yuri)</D2></C2>
    <C2 PS="123"><D2 PS="123" CT_B="349">Khachaturian, Aram (and with
Nina Makarova and with others)</D2></C2>
    <C2 PS="124"><D2 PS="124" CT_B="349">Khrennikov, Tikhon</D2></C2>
    <C2 PS="125"><D2 PS="125" CT_B="349">Knipper, Lev</D2></C2>
    <C2 PS="126"><D2 PS="126" CT_B="349">Knussen, Oliver</D2></C2>
    <C2 PS="127"><D2 PS="127" CT_B="349">Kochanski, Paul</D2></C2>
    <C2 PS="128"><D2 PS="128" CT_B="349">Kraft, V.</D2></C2>
    <C2 PS="129"><D2 PS="129" CT_B="349">Krein, Alexander</D2></C2>
    <C2 PS="130"><D2 PS="130" CT_B="349">Krenz, Jan</D2></C2>
    <C2 PS="131"><D2 PS="131" CT_B="349">Lambre, Guillaume</D2></C2>
    <C2 PS="132"><D2 PS="132" CT_B="349">Leschetizky,
Theodor</D2></C2>
    <C2 PS="133"><D2 PS="133" CT_B="349">Levina, Zara</D2></C2>
    <C2 PS="134"><D2 PS="134" CT_B="349">Liszt, Franz</D2></C2>
    <C2 PS="135"><D2 PS="135" CT_B="349">Logothetis,
Anestis</D2></C2>
    <C2 PS="136"><D2 PS="136" CT_B="349">Lopatnikoff,
Nikolai</D2></C2></C1>
</Photographs_People>
<Photographs_Subjects ID="CL10121002" CTS_B="350, 352" PS="1"
C_TXT="Photographs--Subjects">
  <C1 PS="17"><D1 PS="17" CT_B="350">Bulgarian buildings</D1></C1>
  <C1 PS="18"><D1 PS="18" CT_B="350">Dance map of Latin
America</D1></C1>
  <C1 PS="19"><D1 PS="19" CT_B="350">DAVID, Ferdinand: commemorative
plaque</D1></C1>
  <C1 PS="20"><D1 PS="20" CT_B="350">Immaculate Conception Church,
Boston, Mass.</D1></C1>
  <C1 PS="21"><D1 PS="21" CT_B="350">Latin dancing</D1></C1>
  <C1 PS="22"><D1 PS="22" CT_B="350">Music: printed and
manuscript</D1></C1>
  <C1 PS="23"><D1 PS="23" CT_B="350">Music related</D1></C1>
  <C1 PS="24"><D1 PS="24" CT_B="350">Natural sound workshop</D1></C1>
  <C1 PS="25"><D1 PS="25" CT_B="350">Non-music related</D1></C1>
  <C1 PS="26"><D1 PS="26" C11="see: SCRAPBOOKS BOX 347"
X_TARGET="CLBOX347">Pepperdine University, conferral of honorary
degree to N.S.</D1></C1>
  <C1 PS="27"><D1 PS="27" CT_B="350">Photographic negatives</D1></C1>
  <C1 PS="28"><D1 PS="28" C11="see also:
Photographs--Subject--Miscellaneous BOX 352"
X_TARGET="CL10121002BOX352" CT_B="350">Piano drowning</D1></C1>
  <C1 PS="29"><D1 PS="29" CT_B="350">Slonimsky, Vladimir:
drawings</D1></C1>
  <C1 PS="30"><D1 PS="30" CT_B="350">Tchaikovsky's house</D1></C1>
  <C1 PS="31"><D1 PS="31" XCT_ID="CL10121002BOX352"
CT_B="352">Miscellaneous</D1></C1>
</Photographs_Subjects>
<Artwork ID="CL10121003" CTS_B="350, 352" PS="1">
  <C1 PS="32"><D1 PS="32" CT_B="350">Drawing of Isabelle Vengerova;
Watercolor</D1></C1>
  <C1 PS="33"><D1 PS="33" C11="see also: Artwork--Verdi BOX 352"
X_TARGET="CL10121003BOX352" CT_B="350">Illustrations (Cartoons,
Music, People, Miscellaneous)</D1></C1>
  <C1 PS="34"><D1 PS="34" XCT_ID="CL10121003BOX352"
CT_B="352">Oversize items</D1></C1>
  <C1 PS="35"><D1 PS="35" CT_B="351">Miscellaneous</D1>
    <C2 PS="236"><D2 PS="236">Includes:</D2>
      <C3 PS="1"><D3 PS="1" CT_B="351">Calendar, 1959 (Museum of Fine
Arts, Boston)</D3></C3>
      <C3 PS="2"><D3 PS="2" CT_B="351">History of musical instruments
brochure</D3></C3>
      <C3 PS="3"><D3 PS="3" CT_B="351">Medal</D3></C3></C2></C1>
</Artwork>
</ICONOGRAPHY>

===XSL===
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet   version="1.0"  
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output version="1.0" method="xml" indent="yes" encoding="utf-8"
omit-xml-declaration="no" standalone="no" media-type="text/xml"/>

<xsl:param name="replace"/>
<xsl:template match="/">
  <xsl:comment>
    <xsl:value-of select="concat(' Transformed with ', $replace,
'.xsl ')"/>
  </xsl:comment>
  <xsl:for-each select="comment()">
    <xsl:comment>
      <xsl:value-of select="."/>
    </xsl:comment>
  </xsl:for-each>
  <C01>
<ICONOGRAPHY>
    <xsl:apply-templates
select="//ICONOGRAPHY//@CT_B[not(.=preceding::*[@CT_B]/@CT_B)]">
      <xsl:sort select="."/>
    </xsl:apply-templates>
</ICONOGRAPHY>
<Photographs_People>
    <xsl:apply-templates
select="//ICONOGRAPHY/Photographs_People//@CT_B[not(.=preceding::*[@CT_B]/@CT_B)]">
      <xsl:sort select="."/>
    </xsl:apply-templates>
</Photographs_People>
<Photographs_Subjects>
    <xsl:apply-templates
select="//ICONOGRAPHY/Photographs_Subjects//@CT_B[not(.=preceding::*[@CT_B]/@CT_B)]">
      <xsl:sort select="."/>
    </xsl:apply-templates>
</Photographs_Subjects>
<Artwork>
    <xsl:apply-templates
select="//ICONOGRAPHY/Artwork//@CT_B[not(.=preceding::*[@CT_B]/@CT_B)]">
      <xsl:sort select="."/>
    </xsl:apply-templates>
</Artwork>
  </C01>
</xsl:template>


<xsl:template match="@CT_B">
<B><xsl:value-of select="."/></B>
</xsl:template>

<xsl:template match="text()">
  <xsl:value-of select="translate(., '&#xA;', '')"/>
</xsl:template>

</xsl:stylesheet>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread