RE: [xsl] XHTML [WAS: Grouping into a table (for vertical alignment)]

Subject: RE: [xsl] XHTML [WAS: Grouping into a table (for vertical alignment)]
From: "Daniel Joshua" <daniel.joshua@xxxxxxxxxxxx>
Date: Fri, 28 May 2004 15:34:19 +0800
> _You_ may consider that
>
> <x>
>   <foo/>
>   <bar/>
> </x>
>
>is XHTML, but just not "strictly conforming to the XHTML spec"

That is not even HTML, so would not even pass my 'loose' definition.

Could you tell me what else further I need to modify to get it consider
XHTML.



XSL:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns="http://www.w3.org/1999/xhtml";>

  <xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"

doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
.
.
.
  <xsl:template match="input">
    <xsl:apply-templates select="label"/>

    <td class="data">
      <xsl:element name="input">
        <xsl:attribute name="type">
          <xsl:text>text</xsl:text>
        </xsl:attribute>

        <xsl:for-each select="name | value">
          <xsl:attribute name="{name()}">
            <xsl:value-of select="."/>
          </xsl:attribute>
        </xsl:for-each>
      </xsl:element>
    </td>

    <xsl:apply-templates select="error"/>
  </xsl:template>


Output:

<input type="text" name="userName" value="">
</input>


Validation output (by http://validator.w3.org/):

> 1. Line 160, column 44: end tag for "input" omitted, but OMITTAG NO was
specified
>
> <input type="text" name="userName" value="">
>
> You may have neglected to close a tag, or perhaps you meant to
"self-close" a tag; that is, ending it with "/>" instead of ">".
>
> 2. Line 160, column 0: start tag was here
>
> <input type="text" name="userName" value="">
>
> 3. Line 161, column 7: end tag for element "input" which is not open
>
> </input>
>
> The Validator found an end tag for the above element, but that element is
not currently open.
> This is often caused by a leftover end tag from an element that was
removed during editing,
> or by an implicitly closed element (if you have an error related to an
element being used
> where it is not allowed, this is almost certainly the case). In the latter
case this error
> will disappear as soon as you fix the original problem.

I see that my <input> should have a separate end tag. How do I stop the end
tag from appearing?


Regards,
Daniel


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Thursday, 27 May, 2004 5:30 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] XHTML [WAS: Grouping into a table (for vertical
alignment)]




  I believe you meant the above criteria. However, even if document does not
  strictly comply to the above, it should be still consider XHTML (just not
  strictly-conformant XHTML) as long as it is well-formed HTML.


As far as XPath/XSLT is concerned a namespace is just part of the name
and having the wrong namespace is just the same (and has the same
effects on template matching) as having the wrong local name.

_You_ may consider that

<x>
  <foo/>
  <bar/>
</x>

is XHTML, but just not "strictly conforming to the XHTML spec" but  it's
not clear if this is really a useful distinction. If by "XHTML but not
strictly conforming" you just mean "well formed XML" why not call it
"well formed XML"?

David

Current Thread