Subject: RE: self closing elements with attributes
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Tue, 6 Jan 2004 14:06:17 -0700
|
> From: annirack@xxxxxxx [mailto:annirack@xxxxxxx]
> Sent: Tuesday, January 06, 2004 1:22 PM
> Subject: self closing elements with attributes
>
> I have a template like this:
>
> <xsl:element name="foo">
> <xsl:attribute name="bar">
> some foo
> </xsl:attribute>
> </xsl:element>
>
> I have also tried:
>
> <foo>
> <xsl:attribute name="bar">
> some foo
> </xsl:attribute>
> </foo>
>
> Both give the same result:
>
> <foo bar="some foo">
>
> Which is a problem since it does not close the tag.
Unless something is horribly broken in your XSLT processor, I believe you're
misreading your output. If your output is set to XML (the default if you
don't specify an xsl:output element), you should get a minimized empty
element:
<foo bar="some foo" /> (note the slash before the greater-than bracket)
Saxon omits the space between the attribute value and the slash:
<foo bar="some foo"/>
Either result is valid XML.
cheers,
b.
| brian martinez brian.martinez@xxxxxxxxxxx |
| lead gui programmer 303.357.3548 |
| cheap tickets, part of trip network fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400 englewood, co 80111 |
| cendant travel distribution services http://www.cheaptickets.com/ |
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|