all groups > dotnet xml > april 2004 >
You're in the

dotnet xml

group:

XSLT Transform in .net, xsl:element attributes not generated


XSLT Transform in .net, xsl:element attributes not generated Wayne Lian via .NET 247
4/29/2004 9:52:59 PM
dotnet xml:
Hi all, Just wonder anyone have encountered this problem before?=
I tried using XMLSPY debugger and I can get the correct output=
for my XSLT transformation, however in =2Enet, after=
transformation the attributes I put inside xsl:element tag=
cannot be generated=2E

Part of the XML data:
<?xml version=3D"1=2E0" encoding=3D"utf-8"?>
<receipients>
=09<receipient>
=09=09=2E=2E=2E
=09=09<ServerUrl>http://win2003p2/</ServerUrl>
=09=09<SubmissionUrl>http://win2003p2/online+feedback=2Ehtm</Submission=
Url>
=09=09=2E=2E=2E
=09</receipient>
</receipients>

Part of the XSLT data:
<xsl:element name=3D"form">
<xsl:attribute name=3D"method">post</xsl:attribute>
<xsl:attribute name=3D"target">_blank</xsl:attribute>
<xsl:attribute name=3D"action"><xsl:value-of=
select=3D"SubmissionUrl"/></xsl:attribute>
<table border=3D"0" cellpadding=3D"0" cellspacing=3D"0">
<tr><td width=3D"1" align=3D"left" valign=3D"top">
<xsl:element name=3D"img">
<xsl:attribute name=3D"src"><xsl:value-of=
select=3D"ServerUrl"/>Images/cornerTL=2Egif</xsl:attribute>
<xsl:attribute name=3D"width">7</xsl:attribute>
<xsl:attribute name=3D"height">7</xsl:attribute>
</xsl:element></td>
<td rowspan=3D"3" class=3D"segmentText">Participant Details</td>
</tr>
</table>
=2E=2E=2E
<!-- The form details -->
</xsl:element>

So the correct output is:
<form method=3D"post" target=3D"_blank"=
action=3D"http://win2003p2/online+feedback=2Ehtm">
=2E=2E=2E

But in =2Enet the result given is:
<form>

Code that doing transformation:
StringWriter sw =3D new StringWriter();
XmlWriter writer =3D new XmlTextWriter(sw);
// template is the XslTransform, doc is the XmlDocument
template=2ETransform(doc, new XsltArgumentList(), writer, new=
XmlUrlResolver());

Really appreciate if can help=2E Thanks!!
--------------------------------
From: Wayne Lian

-----------------------
Posted by a user from =2ENET 247 (http://www=2Edotnet247=2Ecom/)

Re: XSLT Transform in .net, xsl:element attributes not generated Oleg Tkachenko [MVP]
5/2/2004 9:53:04 AM
[quoted text, click to view]

btw, why not just
<form method="post" target="_blank"> ?

Anyway, I cannot reproduce the problem. Provide small reproducible
sample please.

PS. By any chance you've got xml:space="preserve" somewhere before
xsl:element?
--
Oleg Tkachenko [XML MVP, XmlInsider]
AddThis Social Bookmark Button