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: <!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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: ampersand in data, Kay Michael | Thread | Re: REQUIRED vs. IMPLIED attribute, David Carlisle |
Re: html fragments, Mike Brown | Date | Re: ampersand in data, Carlos Araya |
Month |