Re: XslTrasnformation - Index was outside the bounds o
I am getting an Index was outside the bounds of the array error when I apply the following template select:
Where do you get the IndexOutOfBoundsError? That is not an XSLT error, so it has to do something with your .NET code.
I assume you do something with the returned results, which are apparently not of the form you expect (?)
Can you paste in a snippet of your C#/VB that raises this exception? What is the source/xslt context of the xslt statement above?
Most notably, this looks like you have something as follows (but I am guessing now):
<xsl:variable name="Fields_MappedForUpdate" select="fx:node-set($xx_fields)" />
Since you have an IOOB error in your .NET code, I assume (guessing again), that the select statement above should produce some output for you and that *with* the "/Field" it does not (like you said). The output must be of a certain form to prevent the IOOB error from occurring (which prompts me to add: some check on the output from the transformation would probably be a good idea).
Still guessing, the most likely cause when nodes suddenly don't match, is a wrong namespace. Since you use a variable, the namespace is the null-namespace (unless the nodes specifically are set with a namespace). If your default namespace differs, you will not have a match. The following example shows this:
xmlns = "urn:test"
<one>This is one</one>
<!-- still inside namespace urn:test, will not match "one" -->
<xsl:apply-templates select="exsl:node-set($data)/one" />
<!-- this will match 'one' -->
<xsl:apply-templates select="exsl:node-set($data)/*[local-name() = 'one']" />
Not sure this helps, however ;-)
Cheers, -- Abel Braaksma http://www.nuntia.nl
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format