[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] self closing elements with attributes


Subject: RE: [xsl] self closing elements with attributes
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 6 Jan 2004 23:54:29 -0000

There's something going on that you haven't shown us. With the XML
output method, it should be impossible for the output to be anything
other than well-formed XML: at any rate, all the tags should be
balanced. Since you're getting the same result on two widely-used XSLT
processors, it's clearly something in your stylesheet that's wrong, but
it's not in the part that you've shown us.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> annirack@xxxxxxx
> Sent: 06 January 2004 20:22
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] self closing elements with attributes
> 
> 
> I'm sure this is a newbie problem, but I can't see what I'm 
> doing wrong.
> 
> 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.  If I try
> 
> <xsl:element name="foo">
> <xsl:attribute name="bar">
> some foo
> </xsl:attribute>
> foo
> </xsl:element>
> 
> or
> 
> <foo>
> <xsl:attribute name="bar">
> some foo
> </xsl:attribute>
> foo
> </foo>
> 
> The result is a correctly closed tag:
> 
> <foo bar="some foo">foo</foo>
> 
> I have tried this with the same results on several varieties 
> of MSXML, and on Xalan-1 and Xalan-2
> 
> Is there anything I can do about this that won't require post 
> processing?
> 
> --Brendan
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords