Hello,
I have a VB.Net component that uses the XslTransform object. I am using
the FXSL randomizeList function in my XSL template. When I transform
the XML in the VB.Net component, my application hangs. When I load the
XML
in a browser with a reference to the XSL template, it works fine.
Here is my XML:
<?xml version="1.0" ?>
<Lists>
<List><Item>Item 1</Item></List>
<List><Item>Item 2</Item></List>
<List><Item>Item 3</Item></List>
<List><Item>Item 4</Item></List>
<List><Item>Item 5</Item></List>
<List><Item>Item 6</Item></List>
<List><Item>Item 7</Item></List>
</Lists>
Here is my XSL:
<xsl:stylesheet version = "1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
exclude-result-prefixes = "xsl" >
<xsl:import href = "randomList.xsl" />
<xsl:output method = "html" />
<xsl:template match = "/" >
<xsl:variable name="vRandFunc">
<xsl:call-template name="randomizeList">
<xsl:with-param name="pList"
select="/Lists/List/Item" />
<xsl:with-param name="pSeed"
select="32768" />
</xsl:call-template>
</xsl:variable>
<table>
<xsl:for-each select="msxsl:node-set($vRandFunc)/*">
<tr>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
Here is my VB.Net code snippet:
' Create the XslTransform and load the stylesheet.
Dim xslt As XslTransform = New XslTransform
xslt.Load(sXslTemplateFile)
' Create an XsltArgumentList.
Dim xslArg As XsltArgumentList = New XsltArgumentList
' Add parameters
xslArg.AddParam("firstelement", "",
iElement.ToString())
xslArg.AddParam("elementsperpage", "",
m_iElementsPerPage.ToString())
'Create an XmlTextWriter to handle the output, but put
it in a string.
Dim sb As StringBuilder = New StringBuilder
Dim sw As StringWriter = New StringWriter(sb)
Dim xw As XmlTextWriter = New XmlTextWriter(sw)
'Transform the file.
xslt.Transform(m_xmlDom.CreateNavigator(), xslArg, xw,
Nothing)
'Get the output
RenderPage = sb.ToString()
When I execute this code, my system hangs and I cannot kill the
application, which is a browser in this case. I load my .Net component
as an object in an HTML page in a browser, and inject the results in
RenderPage to a div tag.
All of my other XSL templates work with this vb.net component, but they
are not using the FXSL randomizeList function.
Also, when I step through my code with the debugger, it hangs at the
line where xslt.Transform is called. It doesn't return from that line.
Rob 1 1488
For more information, please, see my replies in a similar thread in
microsoft.public.xsl.
To summarize, I haven't found any problem with running the randomizeList
template with the XslTransform class of .NET 1.1, using the nXSLT.exe
command-line utility.
It seems, therefore, that the cause of the described issue most probably
lies in the way the XSLT transformation is instantiated in the OP's code and
thus this topic may be more appropriate for this .NET - oriented forum.
Cheers,
Dimitre Novatchev.
<rm*******@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com... Hello,
I have a VB.Net component that uses the XslTransform object. I am using
the FXSL randomizeList function in my XSL template. When I transform the XML in the VB.Net component, my application hangs. When I load the XML in a browser with a reference to the XSL template, it works fine.
Here is my XML: <?xml version="1.0" ?> <Lists> <List><Item>Item 1</Item></List> <List><Item>Item 2</Item></List> <List><Item>Item 3</Item></List> <List><Item>Item 4</Item></List> <List><Item>Item 5</Item></List> <List><Item>Item 6</Item></List> <List><Item>Item 7</Item></List> </Lists>
Here is my XSL: <xsl:stylesheet version = "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes = "xsl" >
<xsl:import href = "randomList.xsl" />
<xsl:output method = "html" />
<xsl:template match = "/" > <xsl:variable name="vRandFunc"> <xsl:call-template name="randomizeList"> <xsl:with-param name="pList" select="/Lists/List/Item" /> <xsl:with-param name="pSeed" select="32768" /> </xsl:call-template> </xsl:variable>
<table> <xsl:for-each select="msxsl:node-set($vRandFunc)/*"> <tr> <td><xsl:value-of select="." /></td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet>
Here is my VB.Net code snippet: ' Create the XslTransform and load the stylesheet. Dim xslt As XslTransform = New XslTransform xslt.Load(sXslTemplateFile)
' Create an XsltArgumentList. Dim xslArg As XsltArgumentList = New XsltArgumentList ' Add parameters xslArg.AddParam("firstelement", "", iElement.ToString()) xslArg.AddParam("elementsperpage", "", m_iElementsPerPage.ToString())
'Create an XmlTextWriter to handle the output, but put it in a string. Dim sb As StringBuilder = New StringBuilder Dim sw As StringWriter = New StringWriter(sb) Dim xw As XmlTextWriter = New XmlTextWriter(sw)
'Transform the file. xslt.Transform(m_xmlDom.CreateNavigator(), xslArg, xw, Nothing) 'Get the output RenderPage = sb.ToString()
When I execute this code, my system hangs and I cannot kill the application, which is a browser in this case. I load my .Net component as an object in an HTML page in a browser, and inject the results in RenderPage to a div tag.
All of my other XSL templates work with this vb.net component, but they are not using the FXSL randomizeList function.
Also, when I step through my code with the debugger, it hangs at the line where xslt.Transform is called. It doesn't return from that line.
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Animesh Sharma |
last post by:
Hi,
Following template matches correctly in MSXML4 but NOT with .Net XSL
translator:
<xsl:template
match="//input]">
<--Do Some operation>
</xsl:template>
|
by: Kevin Westhead |
last post by:
I'm using XslTransform to apply a transform to an XML document, however I
get validation problems when parsing the resulting XML document due to
invalid whitespace. I'm passing in an XPathNavigator...
|
by: LarryR |
last post by:
The following XSLT works fine using MSXML 4.0 (e.g I receive a result in
about 20 seconds), but effectively hangs in both .NET 1.0 sp2 with the XML
hot fix and NET 1.1. My source XML file is...
|
by: John Sever |
last post by:
My transform in cludes a variable that holds a node set from the node-set()
extension function. It the transformation works fine when using MSXML2 or
msxsl.exe but not in VB.Net.
My code looks...
|
by: BLechmann |
last post by:
Hello *,
I'm trying to transform my DocBook document with the FO stylesheet
from the DocBook XSL distribution (the transformation with the XHTML
stylesheet works).
I changed "$years + 1" to...
|
by: Steve |
last post by:
Is there any way of specifying the startMode when using the xslTransform class?
We are updating code which used msxml to the system.xml classes but can find
no way to specify the startMode.
We...
|
by: Yuriy |
last post by:
Hi,
Can anybody explain the following?
Say I have the following source XML and XSLT (see below). No matter what
this XSLT does. It is just a sample to show a problem. the idea is that
XSLT...
|
by: Bob Yuan |
last post by:
Hi, I am working on a asp.net project that takes a xml
source and use XslTransform.transform to generate a xhtml
output.
The problem with using XslTransform is that it
automatically reformats...
|
by: David S. Alexander |
last post by:
I am trying to transform XML to XML using an XSLT in C#, but the root node
of my XML is not being matched by the XSLT if it has an xmlns attribute. Am
I handling my namespaces incorrectly?
My C#...
|
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
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
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...
|
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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |