473,399 Members | 4,254 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,399 software developers and data experts.

XslCompiledTransform closing input tag

I am having a weird issue when I generate an input Html tag from a Xsl
transformation.

When the trasform is executed on the xsl below, the <inputtag has the
closing slash removed in the first case and the closing tag removed in the
second case.

As a side note, if I change <inputto <input1>, the closing tag does not
get removed.

Thanks in advance...
The style sheet is as follows:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<HTML>
<SCRIPT type="text/javascript" language="javascript">
var parserVersion;
function window_onload()
{
buttontable.style.visibility = "visible";
buttontable.style.display = "block";
}
function ApproveDisapproveFromEmail(sUrl)
{
window.open(sUrl, "_blank", "width=600,height=200,
statusbar=no,menubar=no,toolbar=no, addressbar=no, scrollbars=yes");
}
</SCRIPT>
<BODY>
<table id="buttontable" style="font-family: sans-serif, Arial,
Verdana; font-size: 7pt; border-collapse: collapse;visibility:none;
display:none" border="0" cellpadding="4" cellspacing="0" width="201" >
<tbody>
<tr>
<td width="100px" align="center" vertical-align="center">
<tr>
<td width="100px" align="center"
vertical-align="center">
<input type = "button" value="Approve"
id="btnApprove"
onclick="ApproveDisapproveFromEmail(&apos;{//DOCINFO/APPPATH}Approve.htm?&DocumentType={//DOCINFO/DOCTYPE}&DocID={//DOCINFO/DOCID}&apos;);" />

</td>
<td width="1px"></td>
<td width="100px" align="center"
vertical-align="center">
<input type = "button" value="Disapprove"
id="btnDisapprove"
onclick="ApproveDisapproveFromEmail(&apos;{//DOCINFO/APPPATH}Disapprove.htm?&DocumentType={//DOCINFO/DOCTYPE}&DocID={//DOCINFO/DOCID}&apos;);">
</input>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
<noscript>
<table style="font-family: sans-serif, Arial, Verdana;
font-size: 7pt; border-collapse: collapse" border="0" cellpadding="4"
cellspacing="0" width="201" >
<tbody>
<tr>
<td width="100px" style="background-color: #C0C0C0"
align="center" vertical-align="center">
<A>
<xsl:attribute name="href">
<xsl:value-of
select="concat(//DOCINFO/APPPATH,'Approve.htm?&DocumentType=',//DOCINFO/DOCTYPE, '&DocID=', //DOCINFO/DOCID)"/>
</xsl:attribute>Approve
</A>
</td>
<td width="1px"></td>
<td width="100px" style="background-color: #C0C0C0"
align="center" vertical-align="center">
<A>
<xsl:attribute name="href">
<xsl:value-of
select="concat(//DOCINFO/APPPATH,'Disapprove.htm?&DocumentType=',//DOCINFO/DOCTYPE, '&DocID=', //DOCINFO/DOCID)"/>
</xsl:attribute>Disapprove
</A>
</td>
</tr>
</tbody>
</table>
</noscript>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

And the code that processes it is as follows:

private string GetApprovalEmailBody(AcDocument Doc)
{
string strBody = Doc.GetApprovalEmailBody();

//FORM THE XML
XmlDocument MainDocument = new XmlDocument();
string strinfo = "<TOP><DOCINFO><DOCTYPE>" + Doc.Type +
"</DOCTYPE><DOCID>" + Doc.DocID + "</DOCID><APPPATH>" + Doc.ApplicationPath +
"</APPPATH></DOCINFO></TOP>";
MainDocument.LoadXml(strinfo);

//Start the transformation process here
System.IO.StringReader reader = new
System.IO.StringReader(MainDocument.InnerXml);
XPathDocument xmlDoc = new XPathDocument(reader);
XmlDocument xslPage = new XmlDocument();
xslPage.Load(Doc.ApplicationPath +
"Tools/PrepareEmailButtonsHTML.xsl");
XslCompiledTransform xslDoc = new XslCompiledTransform();
xslDoc.Load(xslPage);
System.IO.StringWriter writer = new System.IO.StringWriter();
xslDoc.Transform(xmlDoc, null, writer);

string strButtonHTML = writer.ToString();
if (strButtonHTML == "")
throw (new Exception("Workflow.GetApprovalEmailBody: Error in
preparing the html for buttons. Please contact the administrator"));
XmlDocument TopDocument = new XmlDocument();
TopDocument.LoadXml(strButtonHTML);

Jul 20 '06 #1
1 2739


S. David Kyle wrote:

When the trasform is executed on the xsl below, the <inputtag has the
closing slash removed in the first case and the closing tag removed in the
second case.
Well to generate proper HTML the XSLT processor has to output an empty
element like the input element the HTML way and that is simply
<input>
and not the XML way (which would be
<input/>
or
<input></input>
).
If you don't want the output method html then use
<xsl:output method="xml" />
in the stylesheets but if you want to send HTML to browsers then the
html output method is the right thing.

There are three output methods in XSLT 1.0, html, xml, and text. If you
don't specify one but have a root element with tag name HTML (case
insensitive) and no namespace then html is the default.
You have
<xsl:template match="/">
<HTML>
so the processor uses output method html.
As a side note, if I change <inputto <input1>, the closing tag does not
get removed.

Thanks in advance...
The style sheet is as follows:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<HTML>
<SCRIPT type="text/javascript" language="javascript">
var parserVersion;
function window_onload()
{
buttontable.style.visibility = "visible";
buttontable.style.display = "block";
}
function ApproveDisapproveFromEmail(sUrl)
{
window.open(sUrl, "_blank", "width=600,height=200,
statusbar=no,menubar=no,toolbar=no, addressbar=no, scrollbars=yes");
}
</SCRIPT>
<BODY>
<table id="buttontable" style="font-family: sans-serif, Arial,
Verdana; font-size: 7pt; border-collapse: collapse;visibility:none;
display:none" border="0" cellpadding="4" cellspacing="0" width="201" >
<tbody>
<tr>
<td width="100px" align="center" vertical-align="center">
<tr>
<td width="100px" align="center"
vertical-align="center">
<input type = "button" value="Approve"
id="btnApprove"
onclick="ApproveDisapproveFromEmail(&apos;{//DOCINFO/APPPATH}Approve.htm?&DocumentType={//DOCINFO/DOCTYPE}&DocID={//DOCINFO/DOCID}&apos;);" />

</td>
<td width="1px"></td>
<td width="100px" align="center"
vertical-align="center">
<input type = "button" value="Disapprove"
id="btnDisapprove"
onclick="ApproveDisapproveFromEmail(&apos;{//DOCINFO/APPPATH}Disapprove.htm?&DocumentType={//DOCINFO/DOCTYPE}&DocID={//DOCINFO/DOCID}&apos;);">
</input>
</td>
</tr>
</td>
</tr>
</tbody>
</table>
<noscript>
<table style="font-family: sans-serif, Arial, Verdana;
font-size: 7pt; border-collapse: collapse" border="0" cellpadding="4"
cellspacing="0" width="201" >
<tbody>
<tr>
<td width="100px" style="background-color: #C0C0C0"
align="center" vertical-align="center">
<A>
<xsl:attribute name="href">
<xsl:value-of
select="concat(//DOCINFO/APPPATH,'Approve.htm?&DocumentType=',//DOCINFO/DOCTYPE, '&DocID=', //DOCINFO/DOCID)"/>
</xsl:attribute>Approve
</A>
</td>
<td width="1px"></td>
<td width="100px" style="background-color: #C0C0C0"
align="center" vertical-align="center">
<A>
<xsl:attribute name="href">
<xsl:value-of
select="concat(//DOCINFO/APPPATH,'Disapprove.htm?&DocumentType=',//DOCINFO/DOCTYPE, '&DocID=', //DOCINFO/DOCID)"/>
</xsl:attribute>Disapprove
</A>
</td>
</tr>
</tbody>
</table>
</noscript>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>

And the code that processes it is as follows:

private string GetApprovalEmailBody(AcDocument Doc)
{
string strBody = Doc.GetApprovalEmailBody();

//FORM THE XML
XmlDocument MainDocument = new XmlDocument();
string strinfo = "<TOP><DOCINFO><DOCTYPE>" + Doc.Type +
"</DOCTYPE><DOCID>" + Doc.DocID + "</DOCID><APPPATH>" + Doc.ApplicationPath +
"</APPPATH></DOCINFO></TOP>";
MainDocument.LoadXml(strinfo);

//Start the transformation process here
System.IO.StringReader reader = new
System.IO.StringReader(MainDocument.InnerXml);
XPathDocument xmlDoc = new XPathDocument(reader);
XmlDocument xslPage = new XmlDocument();
xslPage.Load(Doc.ApplicationPath +
"Tools/PrepareEmailButtonsHTML.xsl");
XslCompiledTransform xslDoc = new XslCompiledTransform();
xslDoc.Load(xslPage);
System.IO.StringWriter writer = new System.IO.StringWriter();
xslDoc.Transform(xmlDoc, null, writer);

string strButtonHTML = writer.ToString();
if (strButtonHTML == "")
throw (new Exception("Workflow.GetApprovalEmailBody: Error in
preparing the html for buttons. Please contact the administrator"));
XmlDocument TopDocument = new XmlDocument();
TopDocument.LoadXml(strButtonHTML);
--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jul 21 '06 #2

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

Similar topics

3
by: Eckhard Schwabe | last post by:
when switching from the old "XslTransform " to "XslCompiledTransform" I notice a difference in the handling of whitespace. I need to transform a XML file which contain tabs (\t), and which remain...
1
by: Steve | last post by:
Using VB.NET 2.0 I have a simple routine that attempts transforms an XmlDocument with an XSLT stylesheet into HTML. Under the old 1.1 framework with XslTransform, everything worked fine. Now...
6
by: W. Jordan | last post by:
Hello there, Are there anybody who is using the XslCompiledTransform that comes with .net framework, which was said to be a replacement of the XslTransform class? I found that the class has...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
1
by: mikepmyers | last post by:
I've done some research online and turned up with results that did not sit well with me. I’m using the System.Xml.XslCompiledTransform class as recommended by MS; however, it’s creating self-closing...
1
by: Mark | last post by:
I'm getting the error "The URI scheme is too long." in the code below. What is URI in this context? The XSL or the XML being transformed? Thanks! -Mark StringBuilder sb = new...
3
by: Andy Fish | last post by:
Hi, From reading the documentation, I get the impression that XslCompiledTransform should be faster than XslTransform on my test with a large complex document and a large complex XSLT, the...
1
by: =?Utf-8?B?d2VqaXY=?= | last post by:
When I use xslCompiledTransform() or xslCompiledTransform(false) I find that the XPath queries in my select query attributes do not recognize any attributes inthe xml document. But when I enable...
0
by: bryhi | last post by:
Here is the code you can past in your console application to see the differences. I need to know how to get this to work correctly. #pragma warning disable // because we are using a depricated...
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
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.