[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

namespace output problem

Subject: namespace output problem
From: "James Carlyle" <james.carlyle@xxxxxxxxxx>
Date: Mon, 5 Nov 2001 14:04:25 -0000
namespace output
Hi

I need to output xml to the textarea of an HTML form, using an XSLT
stylesheet, so that I can validate the content of an XML updategram being
posted to SQL Server.  The format of the updategram (the part in the
textarea, bounded by <ROOT>) must match exactly.  My stylesheet needs to
ouput the following:

<?xml version="1.0" encoding="utf-8"?>
<body>
<form action="http://oak/xml" method="POST">
<input type="hidden" name="contenttype" value="text/xml" />
<textarea rows="30" cols="100" name="template">
	<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
	<updg:sync>
	<updg:before>
	</updg:before>
	<updg:after>
	<testData itemLink="http://www.abc.com/1" itemTitle="weblog"/>
	</updg:after>
	</updg:sync>
	</ROOT>
</textarea>
<input type="submit" />
</form>
</body>

My input document looks like:
<?xml version="1.0" encoding="utf-8"?>
<rss>
  <channel>
    <item>
      <link>http://www.abc.com/1</link>
      <title>weblog</title>
      <description>about scripting and stuff like that.</description>
    </item>
  </channel>
</rss>

My stylesheet currently looks like:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:updg="urn:schemas-microsoft-com:xml-updategram"
exclude-result-prefixes="updg">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<html>
<body>
<form action="http://oak/xml" method="POST">
	<input type="hidden" name="contenttype" value="text/xml"/>
	<textarea rows="30" cols="100" name="template">
		<ROOT>
			<xsl:apply-templates select="//item"/>
		</ROOT>
	</textarea>
	<input type="submit"/>
</form>
</body>
</html>
</xsl:template>

<!-- process item-->
<xsl:template match="item">
	<updg:sync>
	<updg:before>
	</updg:before>
	<updg:after>
   	<testData>
   		<xsl:attribute name="itemLink"><xsl:value-of
select="link"/></xsl:attribute>
   		<xsl:attribute name="itemTitle"><xsl:value-of
select="title"/></xsl:attribute>
	</testData>
	</updg:after>
	</updg:sync>
</xsl:template>
</xsl:stylesheet>

I can get the namespace declaration to appear on the updg:sync element, but
not on the ROOT element, unless I add a updg:ROOT prefix to it (this breaks
SQL Server).

I've been through the FAQ looking for a solution, but can find none.  Is
there a way of outputting what I want, while treating xsl:output by
method="xml"?

TIA

James Carlyle


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.