RE: [xsl] Outputting closing-slash in XHTML tags

Subject: RE: [xsl] Outputting closing-slash in XHTML tags
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Sun, 30 Mar 2003 14:53:19 -0700
> From: Gan Uesli Starling [mailto:alias@xxxxxxxxxxx]
> Sent: Sunday, March 30, 2003 2:04 PM
> Subject: [xsl] Outputting closing-slash in XHTML tags
> 
> I have templates like so...
> 
> <xsl:template match="head">
>    <head>
>      <meta http-equiv="Content-Type" content="text/html; 
> charset=UTF-8"/>
>      <xsl:apply-templates select="title"/>
>      <meta name="author" content="Gan Uesli Starling"/>
> 
>    ...and so on...
> 
> </xsl:template>
> 
> ...but the output looks like so...
> 
> <head>
>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
>    <xsl:apply-templates select="title">
>    <meta name="author" content="Gan Uesli Starling">
> 
> ...such that the closing slashes are gone. So the XHTML will
> not validate. I am using Xalan for this.
> 
> How may I fix that, please?

The most likely reason (without seeing your stylesheet) is that your
xsl:output element is set to method="html", which will serialize the result
tree as HTML.  Set your output to "xml" and you should get much closer to
your intended output, although you will run into problems with empty element
minimization (i.e., an empty <textarea> tag may be written as <textarea/>,
which plays havoc on most browsers).  Note that XHTML is not a native
processor output in XSLT 1.0, but will be in XSLT 2.0.

cheers,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| lead gui programmer                                    303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread