Subject: RE: [xsl] attribute of a single-tag node From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Thu, 16 Nov 2006 15:21:56 -0000 |
> sorry for my probably incorrect terminology, but when I say > single- tag nodes I mean a node like <img src="..."> in HTML. As far as the result tree is concerned, you just want an empty element - an element with no children. But you seem more concerned with serialization. Just specify <xsl:output method="xml"/> or <xsl:output method="html"/> and you will get a serialization that works. It might not be exactly how you wanted it, but it will be equivalent. > If I want to create such a tag with specific attributes, how > do I go about doing that? I guess I can't use <xsl:attribute> > because that has to be defined inside the tag. > > Is this the only possible way of doing it: > > <img> > <xsl:attribute name="src"> > <xsl:text><xsl:value-of select="$src"/></xsl:text> > </xsl:attribute> > </img> Actually that's illegal: you can't have elements within xsl:text. But it's grossly unnecessary anyway. Just write: <img src="{@src}"/> Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] attribute of a single-tag, Ronan Klyne | Thread | Re: [xsl] attribute of a single-tag, Nico Van Cleemput |
Re: [xsl] attribute of a single-tag, Ronan Klyne | Date | RE: [xsl] Dynamic sort fx, cknell |
Month |