SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast JoeRags's Avatar
    Join Date
    Jan 2004
    Location
    Delete Account
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP 5 XSL extension unwanted meta tag inclusion

    I'm using PHP 5's XSL extension to transform XML into XHTML 1.0 Strict. In the output, it includes a meta tag in the head and where ever there's an xml:lang attribute it will include a lang attribute. This is very annoying.

    Expected Output:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
      <head>
        <title>Example</title>
      </head>
      <body>
        <h1>Example</h1>
      </body>
    </html>
    Actual Output:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Example</title>
      </head>
      <body>
        <h1>Example</h1>
      </body>
    </html>
    I send application/xhtml+xml to browsers that support it. So that compounds the problem.

    Is there an equivalent to XSLT_SABOPT_DISABLE_ADDING_META? What about the lang attribute inclusion (more like intrusion)?

    Honestly, if I wanted a damn meta tag I would have put it in my stylesheet.

  2. #2
    SitePoint Zealot cholmon's Avatar
    Join Date
    Mar 2004
    Location
    SC
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does your XSL look like? Did you specify an output method? ie
    Code:
     <xsl:output method="xhtml"/>
     
     <!-- 
     ...or simply:
     -->
     
      <xsl:output method="xml"/>

  3. #3
    SitePoint Enthusiast JoeRags's Avatar
    Join Date
    Jan 2004
    Location
    Delete Account
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    xhtml is invalid, I can only use xml.

    Code:
    <xsl:stylesheet
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
      <xsl:output
      method="xml"
      omit-xml-declaration="yes"
      doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
      
      <xsl:template match="/">
        <html xml:lang="en-US">
          <head>
            <title>Example</title>
          </head>
          <body>
            <h1>Example</h1>
          </body>
        </html>
      </xsl:template>
    </xsl:stylesheet>

  4. #4
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JoeRags
    xhtml is invalid, I can only use xml.
    i thought in this case you should use html only

    <xslutput method="html" />

    that is valid and works fine for me...

  5. #5
    SitePoint Zealot ohnnyj's Avatar
    Join Date
    Jun 2003
    Location
    California
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does your xml file look like, I ran a simple xml file such as the following:

    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
     <html>
       <head>
     	<title>Example</title>
       </head>
       <body>
     	<h1>Example</h1>
       </body>
     </html>
    And it generated the output you indicated was expected above.

  6. #6
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Adelaide, South Australia
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Also having this problem.

    I have this problem also and I totally agree with your views on this intrusion. What I find more annoying is that it overides my existing meta content-type element (but I prefer to send the content-type through the HTTP headers so this annoys me all the more).

    ohnnyj, can I see your PHP code? Are you using the XSL with PHP5?

    Anyway, I'm going to look for a fix, but if you have found one please post it. Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •