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

Re: Multiple attributes present and non-present

Subject: Re: Multiple attributes present and non-present
From: Mike Ferrando <mikeferrando@xxxxxxxxx>
Date: Wed, 6 Mar 2002 10:21:44 -0800 (PST)
xsl if 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


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.