XML Namespace PHP forces attribute

Discussion in 'XML' started by Jeff.M, Feb 27, 2008.

  1. Jeff.M

    Jeff.M Guest

    Consider the following XSL:


    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
    Transform" xmlns:php="http://php.net/xsl">
    <xsl:eek:utput method="html"
    doctype-public="-//W3C//DTD HTML 4.01//EN"
    doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
    <xsl:template match="/">
    <html>
    <head>
    <title>Hello</title>
    </head>
    <body>
    <p>fubar</p>
    </body>
    </html>
    </xsl:template>

    </xsl:stylesheet>


    The presence of the xmlns:php="http://php.net/xsl" XML attribute
    causes the same to appear as an attribute of the HTML element in my
    output, like so:


    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
    TR/html4/strict.dtd">
    <html xmlns:php="http://php.net/xsl">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Hello</title>
    </head>
    <body><p>fubar</p></body>
    </html>


    The problem is this isn't valid HTML. Without sacrificing using PHP
    functions as XSLT functions, how do I get this attribute out of my
    output?
    Jeff.M, Feb 27, 2008
    #1
    1. Advertising

  2. Jeff.M

    TOUDIdel Guest

    Uzytkownik "Jeff.M" <> napisal w wiadomosci
    news:...
    > <?xml version="1.0"?>
    > <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
    > Transform" xmlns:php="http://php.net/xsl">
    > <xsl:eek:utput method="html"
    > doctype-public="-//W3C//DTD HTML 4.01//EN"
    > doctype-system="http://www.w3.org/TR/html4/strict.dtd" />
    > <xsl:template match="/">
    > <html>
    > <head>
    > <title>Hello</title>
    > </head>
    > <body>
    > <p>fubar</p>
    > </body>
    > </html>
    > </xsl:template>
    > </xsl:stylesheet>


    if you don't need php prefix in transformation, remove that namespace
    declaration. if you need it in xsl, add exclude-result-prefixes (..
    exclude-result-prefixes="php") attribute in xsl:stylesheet.
    --
    td
    TOUDIdel, Feb 27, 2008
    #2
    1. Advertising

  3. Jeff.M

    Pavel Lepin Guest

    Jeff.M <> wrote in
    <>:
    > The presence of the xmlns:php="http://php.net/xsl" XML
    > attribute causes the same to appear as an attribute of the
    > HTML element in my output, like so:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    > "http://www.w3.org/ TR/html4/strict.dtd">
    > <html xmlns:php="http://php.net/xsl">
    > <head>
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=UTF-8"> <title>Hello</title>
    > </head>
    > <body><p>fubar</p></body>
    > </html>
    >
    > The problem is this isn't valid HTML. Without sacrificing
    > using PHP functions as XSLT functions, how do I get this
    > attribute out of my output?


    Use exclude-result-prefixes attribute on xsl:stylesheet
    element.

    Why do you need PHP functions in your transformation anyway?

    --
    When all you have is a transformation engine, everything
    looks like a tree.
    Pavel Lepin, Feb 27, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?am9obmRvZUBkcml2ZXIubmV0?=

    BUG: Setting Server Control's InnerHtml forces Constructore to be called.

    =?Utf-8?B?am9obmRvZUBkcml2ZXIubmV0?=, Feb 22, 2004, in forum: ASP .Net
    Replies:
    10
    Views:
    1,516
    Guest
    Feb 24, 2004
  2. spammy
    Replies:
    1
    Views:
    523
    bruce barker
    Aug 27, 2004
  3. Dan Sikorsky
    Replies:
    0
    Views:
    454
    Dan Sikorsky
    Jun 2, 2005
  4. gabriel
    Replies:
    1
    Views:
    1,358
    Nobody
    Jun 25, 2003
  5. Rajive Narain
    Replies:
    0
    Views:
    1,702
    Rajive Narain
    Sep 18, 2009
Loading...

Share This Page