XSLT 2.0 validation fails with net.sf.saxon.TransformerFactoryImpl -


i have below sample validate xslt style sheet. in various forums mentioned should "net.sf.saxon.transformerfactoryimpl" xslt 2.0 style sheet. according have updated code. piece of code working few cases. example, code not work sample have attached below. if change sample style sheet version 1 (version="1.0"), code works fine. otherwise fails. believe sample style sheet valid xslt 2.0 document.

this causing lot of problem, how validate style sheet before parse?

   package com.ibm.mq.id;     import javax.xml.transform.transformerconfigurationexception;    import javax.xml.transform.stream.streamsource;     import net.sf.saxon.transformerfactoryimpl;     public class xslttransformationex { /**  * @param args  */ public static void main(string[] args) {           string path="c://work//ex.xsl";         transformerfactoryimpl factory = new transformerfactoryimpl();         try         {              javax.xml.transform.templates template = factory.newtemplates(new  streamsource(path));             //validating  xslt valid or not             //transformer trans =  factory.newtransformer(new streamsource(path));           template.newtransformer();         }         catch(transformerconfigurationexception ex)         {             ex.printstacktrace();         } } } 

and sample xslt below:

    <?xml version="1.0" encoding="utf-8"?>     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0"     xmlns:xs="http://www.w3.org/2001/xmlschema"     xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">     <xsl:output indent="yes" method="xml"/>     <xsl:variable name="familymembers"        select="bpws:getvariabledata('hspact_famlynumbers')"></xsl:variable>     <xsl:template match="molers_output">         <xsl:element name="molers_output">              <!--              <xsl:element name="row">                        <xsl:value-of select="row"/>             </xsl:element>              -->             <xsl:for-each select="row[hosp_acct_num = $familymembers/rows/row/normalize-   space(hacct_)]">                 <xsl:variable name="account"><xsl:value-of select="hosp_acct_num"></xsl:value-of></xsl:variable>                 <xsl:element name="row">                     <xsl:for-each select="node()">                         <xsl:choose>                             <xsl:when test="name()='family_num'">                                 <xsl:element name="family_num">                                     <xsl:value-of select="$familymembers/rows/row[normalize-space(hacct_) = $account]/hafam_"/>                                 </xsl:element>                             </xsl:when>                             <xsl:otherwise>                                 <xsl:copy copy-namespaces="yes" inherit-namespaces="yes">                                     <xsl:value-of select="current()"/>                                 </xsl:copy>                             </xsl:otherwise>                         </xsl:choose>                             </xsl:for-each>                 </xsl:element>             </xsl:for-each>         </xsl:element>     </xsl:template> </xsl:stylesheet> 

your stylesheet has call function named bpws:getvariabledata in namespace http://schemas.xmlsoap.org/ws/2003/03/business-process/ there no definition function compilation error. need define function using xsl:function or xsl:import/include module defines function.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -