
March 26th, 2008, 08:23 AM
|
 |
Contributing User
|
|
Join Date: Jul 2001
Location: Midrand, South Africa
Posts: 154
 
Time spent in forums: 2 Days 14 h 55 m 40 sec
Reputation Power: 7
|
|
|
XHTML Fragments & XSLT
Using the following XSLT:
xml Code:
Original
- xml Code |
|
|
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:output method="html" indent="no"/> <xsl:template match="/"> <xsl:element name="span"> <xsl:attribute name="class"> <xsl:text>myClass</xsl:text> </xsl:attribute> </xsl:element> <xsl:element name="img"> <xsl:attribute name="src"> <xsl:text>image.gif</xsl:text> </xsl:attribute> <xsl:attribute name="alt" /> </xsl:element> <xsl:template> </xsl:stylesheet>
Will yield the following HTML:
html4strict Code:
Original
- html4strict Code |
|
|
|
<span class="myClass"></span> <img src="image.gif" alt="">
But changing the output with:
<xsl  utput method="xml" indent="no" omit-xml-declaration="yes" encoding="utf-8"/>
Will yield the following:
html4strict Code:
Original
- html4strict Code |
|
|
|
<img src="image.gif" alt=""/>
Is there a way I can ensure the span tag's endtag is written and not the collapsed version? Ie <span></span> instead of <span/>
|