473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Generate XSD with XSLT and XML

14
Hey

Im really new to XML and cant find a way how to not have xmlns as an attribute en every element.

The xslt code is:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="xml" />



<xsl:template match="/">
<xsl:element name ="ConfigData" namespace="http://www.w3.org/2001/XMLSchema-instance">
<xsl:element name ="VariableSection">
<xsl:text>&#xA;&#xA;</xsl:text>

<xsl:for-each select="ConfigData/VariableSection/Variable">

<xsl:element name="xs:enumeration">
<xsl:attribute name="value">
<xsl:value-of select="SoftwareName"></xsl:value-of>
</xsl:attribute>
</xsl:element>

<xsl:text>&#xA;</xsl:text>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:template>

</xsl:stylesheet>

-------- And the output is -----

<?xml version="1.0" encoding="utf-8"?><ConfigData xmlns="http://www.w3.org/2001/XMLSchema-instance"><VariableSection xmlns="">

<xs:enumeration value="VA_ResetWTCCommand_Reply" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" />
<xs:enumeration value="VA_ResetWTCCommand_Reply" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" />
<xs:enumeration value="VA_ResetWTCCommand_Status" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" />
<xs:enumeration value="VA_GetEventCommand_Request" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" />

------------

How can i remove the xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" from every line so it i general?

/Lasse
Feb 21 '08 #1
1 5073
jkmyoung
2,057 Expert 2GB
Instead of declaring your element like so:
<xsl:element name="xs:enumeration">

Declare it like:
<xsl:element name ="enumeration" namespace="http://www.w3.org/2001/XMLSchema-instance">
Feb 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Paul Nagle | last post by:
Hi, Can anyone direct me to an example of where PHP is used to parse a basic XML file, and use the contents of this file to generate a HTML page? I am trying to implement a troubleshooting app,...
1
by: Tim:. | last post by:
Hi Can someone tell me how I generate a new XML file that I can then use with an XSLT file. I am trying to use an XML file generated from Microsoft Project or even better generate an XML file from...
2
by: Nick | last post by:
Hi all, I'm about to embark on a new project and can't decide quite how to do it. In summary, I have a database whose data I want to use to create html pages for a website. The website will just...
4
by: Stephen | last post by:
I need to generate input XML for another application by serialising classes defined in an XSD document. The code below will generate the XML I require but I need to generate this in memory rather...
1
by: tconti | last post by:
Howdy: I have 2 general questions regarding the use of XSLT to generate emails. We have several procecesses that use XSLT to generate emails. We frequently run into issues where a client...
13
by: vm98123 | last post by:
Hi, could someone please give me a clue to this one: I do have an xml-File and an xslt-File so that a browser can display the xml-file. What I am trying to do is convert this to pdf or...
1
by: lennyw | last post by:
Hi I'm trying to use XSLT to do an xml to xml transformation where the output xml contains summary data on the information in the input xml. I've succesfully done a Muenchian grouping of the...
1
by: Daniel Hilgarth | last post by:
Hello, I am currently trying to use XSLT for the creation of multiple HTML-files from a single XML-File. This HTML-files need to have links to each other. The following information might be...
5
by: sjangity | last post by:
I am generating xml file that will populate users in a database. assigned_to contains names of developers. reporter contains names of quality engineers. I can't simply just create users...
4
by: Nick | last post by:
I have a critical requirement where I need to club together 4 xml files and display them in an sibngle HTML report. The xmls are generated by Java application by a normal file I/O. Is there a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.