472,353 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

XslCompiledTransform.Load() fails sometimes

Basically the issue is, when the XSL style sheet is loaded by URI it
is cool but when the exact same style sheet loaded by it's contents
the load fails (for this particular style sheet). Because our sheets
are kept in a DB, loading by content is preferable.

Content based load code:

Stream xslStream = new MemoryStream(xslString);
XmlReader xslTextReader = XmlReader.Create(xslStream);
compliedXsl.Load(xslTextReader);

URI based load code:
compliedXsl.Load(xslUri);
The error states that there in an invalid character for the encoding
at line 2140 position 365.

Here is the problematic template from the style sheet (sorry it's so
long i could not include the entire thing, but The line below that
starts with "select="translate(translate(translate(substri ng-
after(..." is line 2140.):

<xsl:template match="IFRAME">
<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="0" WIDTH="100%">
<TR>
<TD/>
</TR>
<TR>
<TD ALIGN="CENTER">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%"
ALIGN="CENTER">
<TR>
<xsl:choose>
<xsl:when test="../IMAGES/GRAPHIC/FILENAME[. != '']">
<TD ALIGN="CENTER">
<IMG NAME="frameimg" ID="frameimg" CLASS="frame">
<xsl:attribute name="SRC"><xsl:value-of select="/DEFAULT/
LINK/IMAGES/GRAPHIC/FILENAME"/></xsl:attribute>
<xsl:if test="/DEFAULT/LINK/IMAGES/GRAPHIC/HEIGHT[. != '']">
<xsl:attribute name="HEIGHT"><xsl:value-of select="/DEFAULT/
LINK/IMAGES/GRAPHIC/HEIGHT"/></xsl:attribute>
</xsl:if>
<xsl:if test="/DEFAULT/LINK/IMAGES/GRAPHIC/WIDTH[. != '']">
<xsl:attribute name="WIDTH"><xsl:value-of select="/DEFAULT/
LINK/IMAGES/GRAPHIC/WIDTH"/></xsl:attribute>
</xsl:if>
<xsl:if test="SHOWBORDER[. = 'True']">
<xsl:attribute name="BORDER">1</xsl:attribute>
</xsl:if>
<xsl:attribute name="ALT"><xsl:value-of select="/DEFAULT/
LINK/IMAGES/GRAPHIC/CAPTION"/></xsl:attribute>
<xsl:attribute name="TITLE"><xsl:value-of select="/DEFAULT/
LINK/IMAGES/GRAPHIC/CAPTION"/></xsl:attribute>
</IMG>
</TD>
</xsl:when>
<xsl:otherwise>
<TD ALIGN="CENTER">
<IFRAME ID="Frame1" NAME="Frame1" WIDTH="99%" FRAMEBORDER="0"
MARGINHEIGHT="1" MARGINWIDTH="1"
ONLOAD="javascript:scrollParentTop();">
<xsl:choose>
<xsl:when test="/DEFAULT/LINK/ID[. != $reglink]">
<xsl:attribute name="SRC"><xsl:value-of select="/DEFAULT/
LINK/URL"/>
<xsl:for-each select="/DEFAULT/GENERAL/REQUEST/
QUERYSTRINGPARAMETER[not(starts-with(.,'L=')) and not(starts-
with(.,'l=')) and not(starts-with(.,'nav='))]">
<xsl:choose><xsl:when test="position() = 1 and
not(contains(/DEFAULT/LINK/URL, '?'))">?</
xsl:when><xsl:otherwise>&amp;</xsl:otherwise></xsl:choose><xsl:value-
of select="substring-before(., '=')" disable-output-escaping="yes"/
>=<xsl:call-template name="url-encode"><xsl:with-param
name="str"><xsl:value-of select="substring-after(., '=')" disable-
output-escaping="yes"/></xsl:with-param></xsl:call-template></xsl:for-
each></xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:attribute name="HEIGHT"><xsl:value-of select="HEIGHT"/
></xsl:attribute>
<xsl:if test="SHOWSCROLLBAR[. = 'False']">
<xsl:attribute name="SCROLLING">No</xsl:attribute>
</xsl:if>
<xsl:if test="SHOWBORDER[. = 'True']">
<xsl:attribute name="STYLE">border:solid <xsl:value-of
select="BORDERCOLOR"/1px</xsl:attribute>
</xsl:if>
<xsl:comment><![CDATA[ -->&nbsp;]]><![CDATA[<!-- ]]></
xsl:comment>
</IFRAME>
<SCRIPT LANGUAGE="JavaScript1.1">
<xsl:comment><![CDATA[
if (document.layers){
document.write("<img name='spacer' src='/images/static/gfx/
pxl_trans.gif' border=0 width=1 height=]]><xsl:value-of
select="HEIGHT"/><![CDATA[>");
document.close();
}
//]]></xsl:comment>
</SCRIPT>
<xsl:if test="/DEFAULT/LINK/ID[. = $reglink]">
<IFRAME id="spinner" SCROLLING="0" FRAMEBORDER="0"
MARGINHEIGHT="0" MARGINWIDTH="0" ALIGN="CENTER" STYLE="LEFT: 300px;
WIDTH: 300px; POSITION: absolute; TOP: 250px; BGCOLOR: #CC0000; Z-
INDEX: 0" SRC="/global/images/pm/loading.gif"/>
</xsl:if>
</TD>
</xsl:otherwise>
</xsl:choose>
</TR>
<xsl:if test="((../IMAGES/GRAPHIC/CAPTION) or (../WINDOW/
SHOWDATE[. = 'True']))">
<TR>
<TD ALIGN="CENTER">
<FONT>
<xsl:attribute name="FACE"><xsl:value-of select="/DEFAULT/
GENERAL/STYLE/FONTS/FONT19/FACE"/></xsl:attribute>
<xsl:attribute name="SIZE"><xsl:value-of select="/DEFAULT/
GENERAL/STYLE/FONTS/FONT19/SIZE"/></xsl:attribute>
<xsl:choose>
<xsl:when test="($linklayout != '0') and ($linklayout !=
'1')">
<xsl:attribute name="COLOR"><xsl:value-of select="/DEFAULT/
LINK/WINDOW/TEXTCOLOR"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="COLOR"><xsl:value-of select="/DEFAULT/
GENERAL/STYLE/FONTS/FONT8/COLOR"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="../IMAGES/GRAPHIC/CAPTION">
<xsl:value-of select="../IMAGES/GRAPHIC/CAPTION"/>
</xsl:if>
<xsl:if test="../WINDOW/SHOWDATE[. = 'True']">
<xsl:value-of select="$whitespace" disable-output-
escaping="yes"/>
<xsl:value-of select="/DEFAULT/GENERAL/DAYDATE"/>
</xsl:if>
</FONT>
<BR/>
</TD>
</TR>
</xsl:if>
<xsl:if test="../PAGEREFRESH[SHOWREFRESHBUTTON = 'True' or
SHOWREFRESHTEXT = 'True' ]">
<TR>
<TD ALIGN="CENTER">
<BR/>
<FORM NAME="RefreshForm">
<xsl:if test="../PAGEREFRESH[SHOWREFRESHBUTTON = 'True']">
<INPUT NAME="RefreshBtn" TYPE="Button" VALUE="Refresh">
<xsl:attribute name="OnClick"><![CDATA[refreshFrame();
return false]]></xsl:attribute>
</INPUT>
</xsl:if>
<xsl:if test="../PAGEREFRESH[SHOWREFRESHTEXT = 'True']">
<BR/>
<FONT>
<xsl:if test="/DEFAULT/GENERAL/STYLE/FONTS/FONT19/FACE[. !=
'Default']">
<xsl:attribute name="FACE"><xsl:value-of select="/DEFAULT/
GENERAL/STYLE/FONTS/FONT19/FACE"/></xsl:attribute>
</xsl:if>
<xsl:attribute name="SIZE"><xsl:value-of select="/DEFAULT/
GENERAL/STYLE/FONTS/FONT19/SIZE"/></xsl:attribute>
<xsl:choose>
<xsl:when test="($linklayout != '0') and ($linklayout !=
'1')">
<xsl:attribute name="COLOR"><xsl:value-of select="/
DEFAULT/LINK/WINDOW/TEXTCOLOR"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="COLOR"><xsl:value-of select="/
DEFAULT/GENERAL/STYLE/FONTS/FONT8/COLOR"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="../PAGEREFRESH/REFRESHTEXT"/>
</FONT>
</xsl:if>
</FORM>
</TD>
</TR>
</xsl:if>
</TABLE>
</TD>
</TR>
</TABLE>
<DIV ID="quickformdiv" STYLE="position: absolute; top: 0; left: 0px;
width: 0; height: 0; visibility: hidden;">
<FORM NAME="qform" TARGET="Frame1" ACTION="/global/pm/
registration.asp">
<SCRIPT LANGUAGE="JavaScript">
<xsl:comment><![CDATA[

var formname = new Array();
var formval = new Array();]]><xsl:for-each select="/DEFAULT/GENERAL/
REQUEST/FORMVARIABLE">
<xsl:variable name="formname">
<xsl:value-of select="substring-before(normalize-space(.),'=')"/
>
</xsl:variable>
<xsl:variable name="formname_clean">
<xsl:choose>
<xsl:when test="starts-with($formname,'_')">
<xsl:value-of select="substring-after($formname,'_')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$formname"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="single_quote">
<xsl:text>&#x27;</xsl:text>
</xsl:variable>
<xsl:variable name="new_line">
<xsl:text/>
</xsl:variable>
<xsl:variable name="carriage_return">
<xsl:text/>
</xsl:variable><![CDATA[formname]]>[<xsl:value-of
select="normalize-space(position())"/>]<![CDATA[= "]]><xsl:value-of
select="$formname_clean"/><![CDATA[";]]><![CDATA[formval]]>[<xsl:value-
of select="normalize-space(position())"/>]<![CDATA[= "]]><xsl:value-of
select="translate(translate(translate(substring-after(.,'='),
'&#x22;', $single_quote), '&#xD;', ''), '&#xA;', '')"/><!
[CDATA[";]]></xsl:for-each><![CDATA[
var currentLinkID = ]]><xsl:value-of select="/DEFAULT/LINK/ID"/><!
[CDATA[;
var regLinkID = ]]><xsl:value-of select="/DEFAULT/GENERAL/REGISTRATION/
LINKNO"/><![CDATA[;
var qf_args = new Object();
var qf_query = document.location.search;
var qf_pairs1 = qf_query.split("?");
var qf_pairs = qf_pairs1[1].split("&");

for(i=0; i < qf_pairs.length; i++) {
var qf_pos = qf_pairs[i].indexOf('=');
if (qf_pos == -1) {
continue;
}
var qf_argname = qf_pairs[i].substring(0,qf_pos);
var qf_value = qf_pairs[i].substring(qf_pos+1);
qf_args[qf_argname] = unescape(qf_value);
}

if (document.getElementById("Frame1") != null) {
var qf_frame1 = document.getElementById("Frame1");
var qf_frame1_src = qf_frame1.src;
}

var qf_method = qf_args["method"];

if (currentLinkID == regLinkID) {
if (qf_method == "post") {
writeQFormElems2();
}
else {
writeQFormElems();
}
}
//]]></xsl:comment>
</SCRIPT>
</FORM>
</DIV>
<SCRIPT LANGUAGE="JavaScript">

if (currentLinkID == regLinkID) {

if (qf_method == "post") {
document.qform.method = "POST";

}
document.qform.action += "?function=" + qf_args["function"];
document.qform.target = "Frame1";
document.qform.submit();
}
</SCRIPT>
</xsl:template>

Any ideas?

-CJ

Mar 27 '07 #1
0 3113

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...
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...
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...
4
by: andrewcw | last post by:
I am moving some code forward from .NET 1.1. I was able to load the XSL file and perform the transform. The MSDN documentation looks like it...
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...
1
by: Hans Kesting | last post by:
Hi, In our ASP.Net webapplications, we use xslt a lot. For 1.1 developing was "easy": start up the website and go to the page where the xslt was...
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? ...
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...
1
by: =?Utf-8?B?Vmlub2Q=?= | last post by:
Hi, I am having a problem doing the transform. Actually i am migrating the code from XslTranform class into XslCompiledTransform class. Here...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.