Namespace alias : Namespace « XSLT stylesheet « XML

XML
1. CSS Style
2. SVG
3. XML Schema
4. XQuery
5. XSLT stylesheet
Java
XML Tutorial
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
XML » XSLT stylesheet » Namespace 
Namespace alias


File: Data.xml

<test xmlns:snee="http://www.java2java.com/dtds/test"
      xmlns:demo2s="http://www.demo2s.com/dtds/test"
      xmlns:domain="http://www.domain.com/dtds/test">
this is a test.
</test>


File: Transform.xslt 
<?xml version="1.0"?>

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

  <xsl:param name="variable-name">v</xsl:param>
  <xsl:param name="default-value" />
  <xsl:output indent="yes" />

  <xsl:namespace-alias stylesheet-prefix="xslt" result-prefix="xsl" />

  <xsl:template match="/" name="main">
    <xslt:stylesheet version="1.0">
      <xslt:variable name="{$variable-name}">
        <xsl:value-of select="$default-value" />
      </xslt:variable>
    </xslt:stylesheet>
  </xsl:template>

</xsl:stylesheet>

Output:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
   <xsl:variable name="v"/>
</xsl:stylesheet>

 
Related examples in the same category
1. namespace axis
2. Deal with the node with namespace
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.