REQUIRED vs. IMPLIED attributes

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

               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">	
      <xsl:attribute name="name">
        <xsl:value-of select="./@linkid"/>
      <xsl:attribute name="date">
        <xsl:value-of select="./@date"/>

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"


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


Bryan Schnabel

 XSL-List info and archive:

Current Thread