XMl to XHTML using XSL with namespace

Posted by user256007 on Stack Overflow See other posts from Stack Overflow or by user256007
Published on 2010-04-02T07:57:27Z Indexed on 2010/04/02 8:03 UTC
Read the original article Hit count: 616

Filed under:
|
|
|

How to handle XML Elements with namespace in an XSL. Here goes my XML Document

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xml" href="wpanel.xsl" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:bong="http://bong/glob/wpanel"
      xml:lang="en"
      lang="en">
  <head>
    <title> Transitional DTD XHTML Example </title>
    <link rel="stylesheet" type="text/css" href="wpanel.css" />
  </head>
  <body>
    <bong:QButton text="Submit"></bong:QButton>
    <bong:QButton text="Reset"></bong:QButton>
  </body>
</html>

and My XSL goes here

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:bong="http://bong/glob/wpanel"
    xmlns:fn="http://www.w3.org/2005/xpath-functions" >
<xsl:output method="xml"
  version="1.0"
  encoding="UTF-8"
  indent="yes" />
<xsl:template match="*|@*">
  <xsl:copy>
    <xsl:apply-templates select="@*"/>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction()|comment()">
  <xsl:copy>.</xsl:copy>
</xsl:template>

I want to copy the elements without bong namespace as it is But transform those using the bong namespace. I think there will be an xsl element or attribute for that.I've serched the net. but haven't found yet.

Thank You.

© Stack Overflow or respective owner

Related posts about xsl

Related posts about Xml