A pattern of the form /descendant::m__id[1] is not legal in either XSLT 1.0 or XSLT 2.0, though it becomes legal in XSLT 3.0.

Saxon is not actually crashing: it reports the error correctly to the ErrorListener, and then the newTemplates() method throws an exception, as required by the JAXP specification. An application should normally catch this exception rather than printing a stack trace, since static errors in the stylesheet are something one would expect to be handled cleanly. If you aren't seeing the error, then there's something wrong with the way your application is doing its error handling. The error message is:

Error at xsl:key on line 9 column 56 of cat_test2.xsl:
  XTSE0340: XSLT Pattern syntax error at char 1 on line 9 in {/descendant::m__id}:
    Axis in pattern must be child or attribute

If XSLTProc allows this, then it is non-conformant with the specification.

Given the structure of your XML, I think you can replace match="/descendant::m__id[1]" with match="category[1]/m_id". (However, the whole design seems rather bizarre, and it's far from clear what it's trying to achieve).

Michael Kay
Saxonica

On 28/08/2012 13:19, Ihe Onwuka wrote:
I have run the attached transformation successfully from Kernow (note
it is XSLT 1.0)  which is running Saxon HE 9.3.0.5.

I have also run it successfully from XSLTProc

It crashes when run from the platform of the product I am using see
error log below.

The vendor hosting the platform thinks it only supports XSLT 1.0
however as per email below they appear to be running Saxon HE 9.2.

Be grateful for any assistance.


---------- Forwarded message ----------
From: Peter Darlington <Peter.Darlington@redbeemedia.com>
Date: Tue, Aug 28, 2012 at 11:56 AM
Subject: RE: New tag that needs exporting
To: Ihe Onwuka <ihe.onwuka@googlemail.com>


Thanks Ihe

They seem to be using Saxon also

As far as I can see the version is saxonhe-9.2.1.1

/home/ec2-user/publisher/jboss/server/default/deploy/publisher.ear/lib/saxonhe-9.2.1.1.jar

Might this explain it?  i.e. when you were testing against saxon where
you using a different / later version?




2012-08-28 10:41:04,794 ERROR
[com.extendmedia.mlp.core.publish.XmlPublisher] Exception occurred on
transformer configuration
javax.xml.transform.TransformerConfigurationException: Failed to
compile stylesheet. 1 error detected.
        at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:212)
        at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:131)
        at com.extendmedia.mlp.core.publish.XmlPublisher.cachePublishFormatTemplate(XmlPublisher.java:273)
        at com.extendmedia.mlp.core.publish.XmlPublisher.publish(XmlPublisher.java:220)
        at com.extendmedia.mlp.search.impl.SearchService.publishCategoryTreeXML(SearchService.java:1192)
        at com.extendmedia.mlp.search.impl.SearchService.buildCategoriesTree(SearchService.java:550)
        at com.extendmedia.mlp.search.impl.SearchService.fetchCategoryTree(SearchService.java:492)
        at sun.reflect.GeneratedMethodAccessor1187.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy366.fetchCategoryTree(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor1187.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at com.extendmedia.mlp.caching.interceptor.MethodCacheInterceptor.invokeMethodAndSaveResults(MethodCacheInterceptor.java:148)
        at com.extendmedia.mlp.caching.interceptor.MethodCacheInterceptor.invoke(MethodCacheInterceptor.java:122)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy402.fetchCategoryTree(Unknown Source)
        at com.extendmedia.mlp.ws.client.CategoryRetrievalWS.fetchCategories(CategoryRetrievalWS.java:195)
        at com.extendmedia.mlp.ws.client.CategoryRetrievalWS$$FastClassByCGLIB$$1481c4b3.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at com.extendmedia.mlp.ws.client.interceptor.WSExceptionHandlingInterceptorPub

-----Original Message-----


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help