[xsl] Lost Attributes?

Subject: [xsl] Lost Attributes?
From: Mike Ferrando <mikeferrando@xxxxxxxxx>
Date: Tue, 5 Mar 2002 10:50:36 -0800 (PST)
Dear friends,
I cannot figure out what happened to my stylesheet. I was doing
great, but now I cannot get my attributes back. Maybe someone could
put their finger on it. Below is my output, my xml and my xsl.

I have truncated these documents so that this will not be such a long
e-mail. 

I did have this all working, but now it does not work.

Mike F.

OUTPUT:===================

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE C03
  SYSTEM "Rodgers1.dtd">
<C03 LEVEL="collection">
   <DID>
      <UNITTITLE>
         <TITLE NORMAL="" LINK="" RENDER="">Allegro</TITLE>
(<UNITDATE NORMAL="" LABEL="" CERTAINTY="">1947</UNITDATE>) lyrics by
<PERSNAME ENCODINGANALOG="700$a" ROLE="lyr" NORMAL="Hammerstein,
Oscar">Oscar Hammerstein</PERSNAME> II</UNITTITLE>
   </DID>
   <C04>
      <DID>
         <CONTAINER TYPE="box-folder">1/1</CONTAINER>
         <UNITTITLE>
            <TITLE ENCODINGANALOG="246$a"
NORMAL="Allegro">Allegro</TITLE>
         </UNITTITLE>
      </DID>
      <ODD>
         <C1005 ENCODINGANALOG="">
            <P>Holograph sketch in pencil ; 3 p.</P>
         </C1005>
         <C1007 ENCODINGANALOG="">
            <P>Includes: [3] p. of unidentified holograph sketches,
one dated as:  <DATE NORMAL="19430701" LABEL="">July 1, '43</DATE>
            </P>
         </C1007>
      </ODD>
   </C04>
   <C04>
      <DID>
         <CONTAINER TYPE="box-folder">1/1</CONTAINER>
         <UNITTITLE>
            <TITLE ENCODINGANALOG="246$a"
NORMAL="Allegro">Allegro</TITLE>
         </UNITTITLE>
      </DID>
      <ODD>
         <C1005 ENCODINGANALOG="">
            <P>Holograph piano-vocal score in pencil ; [8] p.</P>
         </C1005>
         <C1006 ENCODINGANALOG="">
            <P>Laid in: typescript lyric sheet ; [2] p.</P>
         </C1006>
      </ODD>
   </C04>
</C03>
<C03 LEVEL="collection">
   <DID>
      <UNITTITLE>
         <TITLE NORMAL="" LINK="" RENDER="">The American Idea</TITLE>
(<UNITDATE LABEL="television" NORMAL="" CERTAINTY="">1973</UNITDATE>)
television score</UNITTITLE>
   </DID>
   <C04>
      <DID>
         <CONTAINER TYPE="box-folder">1/22</CONTAINER>
         <UNITTITLE>
            <TITLE ENCODINGANALOG="246$a" NORMAL="The American
idea">The American idea : main title theme</TITLE>
         </UNITTITLE>
      </DID>
      <ODD>
         <C1005 ENCODINGANALOG="">
            <P>Holograph condensed score in pencil ; 2 p.</P>
         </C1005>
         <C1007 ENCODINGANALOG="">
            <P>Note:  dated Oct. <DATE NORMAL="" LABEL="">1972</DATE>
            </P>
         </C1007>
      </ODD>
   </C04>
</C03>

XML:==========================

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE RODGERS1>

<RODGERS1>
<SHOW>
<C1001><TITLE>Allegro</TITLE> (<UNITDATE>1947</UNITDATE>) lyrics by
<PERSNAME ENCODINGANALOG="700$a" ROLE="lyr" NORMAL="Hammerstein,
Oscar">Oscar Hammerstein</PERSNAME> II</C1001>

<SONG><C1002>Allegro</C1002>
<SCORE><C1003>1/1</C1003><C1004>Allegro</C1004><C1005 SC300="1 ms. of
music (3 p.)">Holograph sketch in pencil ; 3
p.</C1005><C1007>Includes: [3] p. of unidentified holograph sketches,
one dated as:  <DATE NORMAL="19430701">July 1,
'43</DATE></C1007></SCORE>
<SCORE><C1003>1/1</C1003><C1004>Allegro</C1004><C1005 SC300="1 ms.
vocal score ([8] p.)">Holograph piano-vocal score in pencil ; [8]
p.</C1005><C1006>Laid in: typescript lyric sheet ; [2]
p.</C1006></SCORE>
</SONG>
</SHOW>

<SHOW>
<C1001><TITLE>The American Idea</TITLE> (<UNITDATE
LABEL="television">1973</UNITDATE>) television score</C1001>

<SONG><C1002>The American idea</C1002>
<SCORE><C1003>1/22</C1003><C1004>The American idea : main title
theme</C1004><C1005 SC300="1 ms. condensed score (2 p.)">Holograph
condensed score in pencil ; 2 p.</C1005><C1007>Note:  dated Oct.
<DATE>1972</DATE></C1007></SCORE>
</SHOW>
</RODGERS1>

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"
doctype-system="Rodgers1.dtd" media-type="text/xml"/>

  <xsl:template match="/">
    <xsl:for-each select="//SHOW">
      <xsl:element name="C03">
      <xsl:attribute name="LEVEL">collection</xsl:attribute>
        <xsl:apply-templates select="C1001"/>
        <xsl:apply-templates select="SONG"/>
      </xsl:element>  
    </xsl:for-each>
  </xsl:template>

<xsl:template match="SONG">
    <xsl:apply-templates select="SCORE"/>
    <xsl:apply-templates select="SKETCH"/>
    <xsl:apply-templates select="MMUSIC"/>
</xsl:template>

<xsl:template match="SCORE">
  <xsl:choose>
    <xsl:when test="C1012">
      <xsl:apply-templates select="C1012"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:apply-templates select="C1002"/>
      <xsl:element name="C04">
        <xsl:element name="DID">
          <xsl:apply-templates select="C1003"/>
          <xsl:element name="UNITTITLE">
              <xsl:element name="TITLE">
              <xsl:attribute
name="ENCODINGANALOG">246$a</xsl:attribute>
              <xsl:attribute name="NORMAL"><xsl:copy-of
select="../C1002/node()"/></xsl:attribute>
                <xsl:copy-of select="C1004/node()"/>
              </xsl:element>
              <xsl:apply-templates select="C1010"/>
              <xsl:apply-templates select="C1011"/>
          </xsl:element>
        </xsl:element>
          <xsl:apply-templates select="C1005" mode="hey"/>
        <xsl:element name="ODD">
            <xsl:apply-templates select="C1005 | C1006 | C1007 |
C1009"/>
        </xsl:element>
      </xsl:element>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="C1005 | C1006 | C1007">
  <xsl:element name="{name()}">
  <xsl:attribute name="ENCODINGANALOG">
    <xsl:value-of select="../@LINK"/>
  </xsl:attribute>
      <xsl:element name="P">
        <xsl:copy-of select="node()"/>
      </xsl:element>
  </xsl:element>
</xsl:template>

<xsl:template match="C1005" mode="hey">
  <xsl:element name="{name()}">
    <xsl:attribute name="ENCODINGANALOG"><xsl:copy-of
select="node()"/></xsl:attribute>
    <xsl:value-of select="@SC300"/>
  </xsl:element>
</xsl:template>

</xsl:stylesheet>

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

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


Current Thread