473,394 Members | 1,766 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,394 software developers and data experts.

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

Hi all, Just wonder anyone have encountered this problem before?I tried using XMLSPY debugger and I can get the correct outputfor my XSLT transformation, however in .net, aftertransformation the attributes I put inside xsl:element tagcannot be generated.

Part of the XML data:
<?xml version="1.0" encoding="utf-8"?>
<receipients>
<receipient>
...
<ServerUrl>http://win2003p2/</ServerUrl>
<SubmissionUrl>http://win2003p2/online+feedback.htm</SubmissionUrl>
...
</receipient>
</receipients>

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

So the correct output is:
<form method="post" target="_blank"action="http://win2003p2/online+feedback.htm">
...

But in .net the result given is:
<form>

Code that doing transformation:
StringWriter sw = new StringWriter();
XmlWriter writer = new XmlTextWriter(sw);
// template is the XslTransform, doc is the XmlDocument
template.Transform(doc, new XsltArgumentList(), writer, newXmlUrlResolver());

Really appreciate if can help. Thanks!!
--------------------------------
From: Wayne Lian

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>AkMEKzoeS0CgPm0ice4BDw==</Id>
Nov 12 '05 #1
1 1772
Wayne Lian via .NET 247 wrote:
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 .net, after transformation the
attributes I put inside xsl:element tag cannot be generated. Part of the XSLT data: <xsl:element name="form"> <xsl:attribute
name="method">post</xsl:attribute> <xsl:attribute
name="target">_blank</xsl:attribute>


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]
http://blog.tkachenko.com
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt | last post by:
For example, how to represent hyperlink in XSL? I want to add hyperlink in XSL. i.e. I need to generate <A HREF="http://mypage.html">home page</A> in HTML. I tried the following approaches but...
6
by: Thomas | last post by:
In Mozilla: The problem we are trying to solve: We are using XSL/XML to generate tables with text in the rows. The spacing is wider then when those same exact tables are created in regular HTML....
1
by: Filip Hendrickx | last post by:
Hi there. I want to generate elements, choosing the element name dynamically. So I tried to use attribute value templates: <xsl:element name="{$local-name($someNode)}"> <!-- Generate element...
9
SPanicker
by: SPanicker | last post by:
Hi, I am newbie to XSL transformations. I am finding it hard to work out the XSL transformation for the following XML. Can someone suggest me how to approach this XML or in general how should I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.