Menu

Please help for xslt 2.0 saxon .net (Index was outside bounds of array)

saxon-help
Kubix
2012-11-13
2012-11-14
  • Kubix

    Kubix - 2012-11-13

    Hi

    My C# codes

    Processor xsltProcessor = new Processor();
    XdmNode input = xsltProcessor.NewDocumentBuilder().Wrap(doc);
    XsltTransformer transformer = xsltProcessor.NewXsltCompiler().Compile(new Uri(HttpContext.Current.Server.MapPath(xsltPath))).Load();
    transformer.InitialContextNode = input;
    Serializer serializer = new Serializer();
    MemoryStream stream = new MemoryStream();
    serializer.SetOutputStream(stream);
    transformer.Run(serializer);
    stream.Position = 0;
    StreamReader read = new StreamReader(stream);
    return read.ReadToEnd();


    test.xslt

    <xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="fn"
    exclude-result-prefixes="xs fn">

    <xsl:output method="html" indent="yes"/>

    <xsl:template match="/">
    <table>
    <tr>
    <td>id</td>
    <td>test 1</td>
    <td>test 2</td>
    </tr>
    <xsl:apply-templates select="//item"></xsl:apply-templates>
    </table>
    </xsl:template>
    <xsl:template match="item">
    <tr>
    <td>
    <xsl:value-of select="replace(id, '1', 'bir')"/>
    </td>
    <td>
    <xsl:value-of select="customerame"/>
    </td>
    <td>
    <xsl:value-of select="adres"/>
    </td>
    </tr>
    </xsl:template>
    </xsl:stylesheet>


    transformer.Run(serializer); line is throwing error : Index was outside bounds of array.

    Please help;
    Best regards

     

    Last edit: Kubix 2012-11-13
  • Michael Kay

    Michael Kay - 2012-11-13

    Thanks for reporting it. For future reference, the preferred place to report Saxon problems is http://saxonica.plan.io/. Could you confirm which Saxon version you are using?

     
  • Kubix

    Kubix - 2012-11-13

    I'm using SaxonHE 9.4 for .net same error giving SaxonPE 9.4 for .net
    Thanks

     
  • oneil

    oneil - 2012-11-14

    Hi Kubix,

    Thanks for reporting the problem you have found.
    A bug issue has been created, please see: https://saxonica.plan.io/issues/1645

    I have followed through the setup you described in the thread, however I have been unable to reproduce the error. Please may you provide me with the specific version number of Saxon 9.4 that you are using. The current release is Saxon 9.4.0.6. Also any details of your environment, such as .Net version would be useful. Thanks