This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Multiple attributes present and non-present


Dear Friends,
I am having a problem with my testing for empty attributes. I had
this working, but now it doesn't. Can't figure it out (below).

The trouble is that I have attributes I don't want displayed in these
elements. Some of these attributes are going to become data in the
new element tag like @SC300. So I need some way to test for an empty
attribute. I thought that:

<xsl:if test="@ENCODINGANALOG/text()"/>

would do this.

I did have it working. I changed the name of the @LINK attribute to
@ENCODINGANALOG then changed the name in my stylesheet and now I get
no attribute values at all, or I am back to empty attributes "".

Any ideas?

Mike F.

XML:
<SONG><C1002>Finale act 1</C1002>
<SCORE>
<C1003>1/4</C1003>
<C1004>Finale act one</C1004>
<C1005 ENCODINGANALOG="300$81\c$a" SC300="1 ms. vocal score (13
p.)">Holograph piano-vocal score in pencil ; 13 p.</C1005>
<C1009 ENCODINGANALOG="500$81\c$a">data.........</C1009>
<C1006>Laid in: typescript lyric sheet ; [6] p.</C1006>
</SCORE>
</SONG>



NOT WORKING:====================
<xsl:template match="C1005" mode="hey1">
  <xsl:element name="PHYSDESC">
    <xsl:if test="@ENCODINGANALOG/text()">
      <xsl:attribute name="ddddd">
        <xsl:value-of select="@ENCODINGANALOG"/>
      </xsl:attribute>
    </xsl:if>
    <xsl:value-of select="@SC300"/>
  </xsl:element>
</xsl:template>

OUTPUT:====================
<C04>
  <DID>
    <CONTAINER TYPE="box-folder">1/4</CONTAINER>
      <UNITTITLE>
        <TITLE ENCODINGANALOG="246$a" NORMAL="Finale act 1">Finale
act one</TITLE>
      </UNITTITLE>
C1005 "hey1"--> <PHYSDESC>1 ms. vocal score (13 p.)</PHYSDESC>
  </DID>
  <ODD>
C1005 "hey2"-->   <NOTE>
                    <P>Holograph piano-vocal score in pencil ; 13
p.</P>
                  </NOTE>
C1009 -->         <NOTE>data........</NOTE>
C1006 -->         <NOTE>
                    <P>Laid in: typescript lyric sheet ; [6] p.</P>
                  </NOTE>
  </ODD>
</C04>


WORKS:=========================

<xsl:template match="C1005" mode="hey1">
  <xsl:element name="PHYSDESC">
    <xsl:attribute name="ddddd">
      <xsl:value-of select="@ENCODINGANALOG"/>
    </xsl:attribute>
    <xsl:value-of select="@SC300"/>
  </xsl:element>
</xsl:template>

OUTPUT:=====================
<PHYSDESC ddddd="300$81\c$a">1 ms. vocal score (13 p.)</PHYSDESC>

OUTPUT:=====================
<PHYSDESC ddddd="">data.......</PHYSDESC>

Any idea what I am doing wrong?

Mike F.

__________________________________________________
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]