Subject: Re: [xsl] Problems passing attributes From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 28 Sep 2001 14:14:44 -0400 |
<xsl:template match="table"> <table cellspacing="0" cellpadding="0"> <xsl:copy-of select="@border"/> <!-- do the table thing --> </table> </xsl:template>
<xsl:template match="table"> <table> <xsl:copy-of select="@*"/> <!-- do the table thing --> </table> </xsl:template>
Cheers, Wendell
If you *always* want to emit a border attribute, and you *always* want it to be a numeric value (not null), here's an easy way:
<xsl:template match="table"> <table cellspacing="0" cellpadding="0" border="0"> <xsl:if test="@border != ''"><!-- if attribute exists and is non-null --> <xsl:attribute name="border"> <xsl:value-of select="@border"/><!-- use it's value --> </xsl:attribute> </xsl:if> <!-- do the table thing --> </table> </xsl:template>
The last attribute specified in the literal result element takes precedence if the same attribute name is used more than once.
If you only want to emit a border attribute when a non-null one is specified on input, just leave the 'border="0"' out of the literal result element begin tag.
If you don't care about emitting null border attributes, this is the most compact: <table cellspacing="0" cellpadding="0" border="{@border}"> <!-- do the table thing --> </table>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Problems passing attribut, Paul Tyson | Thread | [xsl] Is there a XSL XSD?, gmckessock |
RE: [xsl] Is there a XSL XSD?, Matthew L. Avizinis | Date | Re: [xsl] Is there a XSL XSD?, gmckessock |
Month |