Project

Profile

Help

Compiling altova mapforce xslt 2.0 in saxon

Added by Anonymous almost 16 years ago

Legacy ID: #6512808 Legacy Poster: Nir Avneyon (nir_avneyon)

Hi, When i try to compile xslt 2.0 that i created in altova mapforce with saxon(.net) i get the follwing error : "Failed to compile stylesheet. 1 error detected." this happens in the processor.NewXsltCompiler().Compile line. Is this problem familiar to anyone? Thanks, Nir. ------------------------C# Code --------------------------------------------------- Processor processor = new Processor(); XdmNode input = processor.NewDocumentBuilder().Build(new Uri(@"C:/AltovaTest/Price.xml")); XsltTransformer transformer = processor.NewXsltCompiler().Compile(new Uri(@"C:\AltovaTest\Checjout XSLT 2.0\MappingMapToCheckout.xslt")).Load(); transformer.InitialContextNode = input; transformer.BaseOutputUri = new Uri(@"C:\AltovaTest\Checjout XSLT 2.0\MappingMapToCheckout.xslt"); Serializer serializer = new Serializer(); serializer.SetOutputFile((@"C:\AltovaTest\CheckoutXslt2.xml")); //for file transformer.Run(serializer); ------------------------XSLT CODE-------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="fn xs xsi xsl"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:param name="BagInstance" select="'C:/AltovaTest/Bag.xml'"/> <xsl:template match="/Prices"> <Checkout> <xsl:attribute name="xsi:noNamespaceSchemaLocation" separator=" "> <xsl:sequence select="'C:/AltovaTest/Checkout.xsd'"/> </xsl:attribute> <xsl:variable name="Vvar1_firstSource" select="."/> <xsl:for-each select="doc($BagInstance)/Bag"> <xsl:variable name="Vvar2_Bag" select="."/> <xsl:for-each select="Prdouct1"> <xsl:variable name="Vvar36_Prdouct1_string" as="xs:string" select="xs:string(.)"/> <xsl:for-each select="$Vvar1_firstSource/Price1"> <xsl:variable name="Vvar64_Price1_int" as="xs:int" select="xs:int(.)"/> <xsl:for-each select="$Vvar2_Bag/Prdouct2"> <xsl:variable name="Vvar68_Prdouct2_string" as="xs:string" select="xs:string(.)"/> <xsl:for-each select="$Vvar1_firstSource/Price2"> <xsl:variable name="Vvar71_Price2_int" as="xs:int" select="xs:int(.)"/> <xsl:for-each select="$Vvar2_Bag/Product3"> <xsl:variable name="Vvar75_Product3_string" as="xs:string" select="xs:string(.)"/> <xsl:for-each select="$Vvar1_firstSource/Price3"> <xsl:variable name="Vvar78_Price3_int" as="xs:int" select="xs:int(.)"/> <Total> <xsl:sequence select="xs:int((((xs:decimal($Vvar36_Prdouct1_string)) * (xs:decimal($Vvar64_Price1_int))) + ((xs:decimal($Vvar68_Prdouct2_string)) * (xs:decimal($Vvar71_Price2_int)))) + ((xs:decimal($Vvar75_Product3_string)) * (xs:decimal($Vvar78_Price3_int))))"/> </Total> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:for-each> </xsl:for-each> </Checkout> </xsl:template> </xsl:stylesheet> ---------------------------------------------------------------------------------------


Replies (1)

RE: Compiling altova mapforce xslt 2.0 in saxon - Added by Anonymous almost 16 years ago

Legacy ID: #6512993 Legacy Poster: Michael Kay (mhkay)

The error message just says that compilation failed. The first thing you need to do is to find out why. By default compiler error messages are sent to the standard error output, and it looks as if your application is not displaying this. You can capture the errors by associating an error list with the XsltCompiler, and then displaying the errors that are written to this list. Alternatively, try compiling the stylesheet from the command line, which will (in most cases) display the same errors. In fact, when I do this, I get 7 errors (I don't know why you only got one). Error at xsl:variable on line 16 column 72 of test.xsl: XPST0080: XPath syntax error at char 9 on line 16 in {xs:int(.)}: The type xs:int is not recognized by a Basic XSLT Processor. Error at xsl:variable on line 16 column 72 of test.xsl: XPST0080: SequenceType syntax error at char 0 in {xs:int}: The type xs:int is not recognized by a Basic XSLT Processor. Error at xsl:variable on line 20 column 72 of test.xsl: XPST0080: XPath syntax error at char 9 on line 20 in {xs:int(.)}: The type xs:int is not recognized by a Basic XSLT Processor. Error at xsl:variable on line 20 column 72 of test.xsl: XPST0080: SequenceType syntax error at char 0 in {xs:int}: The type xs:int is not recognized by a Basic XSLT Processor. Error at xsl:variable on line 24 column 72 of test.xsl: XPST0080: XPath syntax error at char 9 on line 24 in {xs:int(.)}: The type xs:int is not recognized by a Basic XSLT Processor. Error at xsl:variable on line 24 column 72 of test.xsl: XPST0080: SequenceType syntax error at char 0 in {xs:int}: The type xs:int is not recognized by a Basic XSLT Processor. Error at xsl:sequence on line 26 column 264 of test.xsl: XPST0080: XPath syntax error at char 238 on line 26 in {...decimal($Vvar78_Price3_int)...}: The type xs:int is not recognized by a Basic XSLT Processor. Failed to compile stylesheet. 7 errors detected. Saxon is enforcing a rule that's present in the XSLT specification for "basic" (non-schema-aware) processors, which defines exactly which of the XMLSchema types are available, and the list does not include xs:int. In fact you can get around this restriction without upgrading to Saxon-SA by including the attribute saxon:allow-all-built-in-types="yes" in the xsl:stylesheet element. The namespace prefix saxon should be bound to "http://saxon.sf.net/". Because you only got one error, it might be that your problem is different. First find out what errors you are actually getting.

    (1-1/1)

    Please register to reply