Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8130473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:43:24+00:00 2026-06-06T08:43:24+00:00

I have an XSL that is transforming one XSD into another XSD that has

  • 0

I have an XSL that is transforming one XSD into another XSD that has slightly different formatting. (Basically, the target file will be normalized). The other major difference in the target is adding a default namespace and a target namespace. I’m having trouble actually getting the namespace in. Here is a snippet of my XSL:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
    <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
    <xsl:variable name="Unions" select="'Yes'"/>
    <xsl:variable name="myname" select="//Table/Name"/>
    <xsl:variable name="namespace" select="concat('http://mynamespace/', $myname)"/>
  <xsl:template match="/">
    <xsl:element name="xsd:schema" namespace="http://www.w3.org/2001/XMLSchema" xmlns="$namespace"

      <xsl:attribute name="targetNamespace">
        <xsl:value-of select="$namespace"/>
      </xsl:attribute>
      <xsl:attribute name="elementFormDefault">qualified</xsl:attribute>
      <xsl:attribute name="attributeFormDefault">unqualified</xsl:attribute>
...
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

And this is what I’m getting:

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema targetNamespace="http://mynamespace/somename" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="">
...
</xsd:schema>

And xmlns=”$namespace” is tagged on to every child node. I’m no absolute expert on XSLT. I have not had to develop it myself because BizTalk maps generate all of it for you, but this XSL was more complex than I could get BizTalk maps to handle.

Oh, and I’m limited to XSLT 1.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:43:25+00:00Added an answer on June 6, 2026 at 8:43 am

    Generating namespace nodes with dynamically generated values is something XSLT 1 can’t really do. XSLT 2 adds xsl:namespace specifically to construct such things.

    You said you are stuck at XSLT 1. Do you have EXSLT or any other extension namespace available that gives you the node-set() extension? If so you can go

     <xsl:template match="/">
    
     <xsl:variable name="x">
     <xsl:element name="x" namespace="{$namespace}">
       <xsl:element name="xsd:schema" namespace="http://www.w3.org/2001/XMLSchema">
       ....
     </xsl:variable>
     <xsl:copy-of select="xx:node-set($x)/*/*"/>
    </xsl:template>
    

    Creating a spurious element <x> in the desired namespace, this forces the namespace node on to its child xs:schema element which you can extract if you have a node-set extension function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a XSL that transforms one format of XML into another. In input
I have an XSL stylesheet (A) that imports another one (B). A overrides a
I have an XML(XHTML) file which I'm transforming into another XML file by using
I have an xml document that I am transforming with xslt into an xsl-fo
I have an XSL that transforms an XML file into a HTML file. Works
i have the following XSL that will transform an XML file and basically flatten
I have developed an XSL file that transforms xml files into a html table.
I have a series of XSL 2.0 stylesheets that feed into each other, i.e.
I have two xsl file each for different type of machines for various unix
I have an XSL file that I am generating from CSV from and Object

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.