Project

Profile

Help

castable as xs:int and xs:long in XSLT

Added by Anonymous over 14 years ago

Legacy ID: #8109317 Legacy Poster: Ross B. (rossbrower)

Are these statements not possible in XSLT or am I missing something? castable as xs:integer works fine, but it seems strange these do not. xml: xslt: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xsl:output method="xml" indent="yes"/> <xsl:template match="property" > <xsl:value-of select="@value castable as xs:int" /> </xsl:template> </xsl:stylesheet> result: Message: Failed to compile stylesheet. 1 error detected. Data: System.Collections.ListDictionaryInternal InnerException: TargetSite: Void prepare(javax.xml.transform.Source) StackTrace: at net.sf.saxon.PreparedStylesheet.prepare(Source styleSource) at net.sf.saxon.TransformerFactoryImpl.newTemplates(Source source, CompilerInfo info) at Saxon.Api.XsltCompiler.Compile(XdmNode node) at XmlVisualizerLibrary.SaxonEvaluator.TryXsltTransform(XdmNode inputXml, XmlDocument expression) in C:\Azaleos\Tools\XmlVisualizerV2\XmlVisualizerLibrary\SaxonEvaluator.cs:line 158 at XmlVisualizerLibrary.SaxonEvaluator.Evaluate(String data, String expression) in C:\Azaleos\Tools\XmlVisualizerV2\XmlVisualizerLibrary\SaxonEvaluator.cs:line 44 at XmlVisualizerLibrary.EvaluatorBase.EvaluateWorker(String data, String expression, AsyncOperation asyncOperation) in C:\Azaleos\Tools\XmlVisualizerV2\XmlVisualizerLibrary\EvaluatorBase.cs:line 30 HelpLink: Source: saxon9he xml: xpath: property/@value castable as xs:int result: false xml: xslt: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xsl:output method="xml" indent="yes"/> <xsl:template match="property" > <xsl:value-of select="@value castable as xs:integer" /> </xsl:template> </xsl:stylesheet> result: false


Replies (1)

RE: castable as xs:int and xs:long in XSLT - Added by Anonymous over 14 years ago

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

Sorry not to respond sooner. Saxon HE conforms to the rules for an XSLT 2.0 "Basic Processor", and the conformance rules for such a processor disallow types such as xs:int and xs:long; they are allowed only in a schema-aware processor (though you don't actually need to be doing schema-aware processing).

    (1-1/1)

    Please register to reply