467,912 Members | 1,588 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,912 developers. It's quick & easy.

vb.net xsltransform hangs with fxsl randomizeList template

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

Feb 2 '06 #1
  • viewed: 1346
Share:
1 Reply
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

Feb 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Animesh Sharma | last post: by
5 posts views Thread by Kevin Westhead | last post: by
6 posts views Thread by BLechmann | last post: by
1 post views Thread by Bob Yuan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.