xsl-list
[Top] [All Lists]

RE: [xsl] Saxon 8B returns profile and version attributes from XHTML 1.1

2006-10-23 07:23:40
Nice!

I thought it was necessary to use the unparsed-text() function and regex to
test if an XHTML document is 1.0 or 1.1. It is news to me that we can say:

<xsl:if test="//@version eq '-//W3C//DTD XHTML 1.1//EN'">
<!-- etc -->

Jesper


-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: 23. oktober 2006 12:35
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Saxon 8B returns profile and version attributes from
XHTML 1.1


I think you will find that the DTD referenced in the source document defines
default values for these attributes, and that the XML parser is therefore
expanding the document to include these values before passing it on to
Saxon.

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Jesper Tverskov [mailto:jesper(_at_)tverskov(_dot_)dk] 
Sent: 23 October 2006 10:40
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Saxon 8B returns profile and version 
attributes from XHTML 1.1

Hi list

When I use Saxon 8B to return attributes and their values 
from XHTML documents, something strange happens.

If the document is XHTML 1.0 Strict! the attributes returned 
are correct, but when the document is XHTML 1.1, a strange 
empty "profile" attribute is also returned. Such a "profile" 
attribute does not exist in XHTML. Also a "version" attribute 
is returned ... there is no such thing in XHTML.

XSLT, input and output documents are shown below:
 
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns="http://www.w3.org/1999/xhtml";
xmlns:xhtml="http://www.w3.org/1999/xhtml"; version="2.0"
    exclude-result-prefixes="xhtml">
    <xsl:output indent="yes"/>
    <xsl:template match="/">
        <html>
            <head>
                <title>Strange attributes</title>
            </head>
            <body>
                <xsl:for-each select="//@*">
                    <p>
                        <xsl:value-of select="name()"/>
                        <xsl:text>: "</xsl:text>
                        <xsl:value-of select="."/>
                        <xsl:text>"</xsl:text>
                    </p>
                </xsl:for-each>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>


Input document:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
                      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
    <head>
        <title/>
    </head>
    <body class="yes">
        <p>asdf</p>
    </body>
</html>


Output document:

<p>version: "-//W3C//DTD XHTML 1.1//EN"</p>
<p>profile: ""</p>
<p>class: "yes"</p>


Best regards,

Jesper Tverskov
http://www.xmltraining.biz






--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>