[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] REQUIRED vs. IMPLIED attributes
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|