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

REQUIRED vs. IMPLIED attributes

Subject: REQUIRED vs. IMPLIED attributes
From: bryan.s.schnabel@xxxxxxxxxxxxxx
Date: Fri, 21 Jul 2000 13:36:52 -0700
required implied
If my DTD defines an element with some REQUIRED and some IMPLIED attributes:

<!ELEMENT Link  (#PCDATA) >
<!ATTLIST Link
               linkid  CDATA    #REQUIRED
               date    CDATA    #IMPLIED  >

And I have an instance that SOMETIMES uses the implied attribute:

...some text<Link linkid="d4545" date="19JUL00">some text</Link> 
some textsome text some text <Link linkid="d4546">some text</Link> some
text. . .

And I want to capture all possible combinations and deal with them:

<xsl:template match="Link">	
  <h2>
      <xsl:attribute name="name">
        <xsl:value-of select="./@linkid"/>
      </xsl:attribute>
      <xsl:attribute name="date">
        <xsl:value-of select="./@date"/>
      </xsl:attribute>
  <xsl:apply-templates/>
  </h2>
</xsl:template>

The result is CLOSE, but not exactly correct

...some text<h2 name="d4545" date="19JUL00">some text</h2> 
some text some text <h2 name="d4546" date="">some text</h2> some text. . .

(date="" is the undesired output)

Is there a better way?

(such as perhaps) Is there a generic way to code for 
1. "grab any attribute and simply repeat it"

or

2. "grab IMPLIED attribute WHEN they're there
    and deal with them"

Thanks,

Bryan Schnabel


 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.