Question

I want to transform a html to xml, performing transformation XSLT, but I see this error:

<message>
Impossible to read XSLT from 'file:/home/antonmm/src/cardMarket/cocoon-cardmarket/src/main/resources/COB-INF/xsl/productCard.xsl', see nested exception
</message>
<stacktrace>
org.apache.cocoon.pipeline.SetupException: Impossible to read XSLT from 'file:/home/antonmm/src/cardMarket/cocoon-cardmarket/src/main/resources/COB-INF/xsl/productCard.xsl', see nested exception at org.apache.cocoon.sax.component.XSLTTransformer.loadXSLT(XSLTTransformer.java:168) at org.apache.cocoon.sax.component.XSLTTransformer.setConfiguration(XSLTTransformer.java:205) at ......

block in cocoon:

  <map:pipeline>
    <map:match pattern="product">
<!--       <map:generate src="sample/p.xml"/> -->
      <map:generate src="https://productweb.com"/>
      <map:transform src="xsl/product.xsl" />
      <map:serialize type="xml"/>
    </map:match>
  </map:pipeline>

product.xsl:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:x="http://www.w3.org/1999/xhtml" />
  <xsl:template match="/">
    <img>
      <xsl:apply-templates />
    </img>
  </xsl:template>
  <xsl:template match="x:span[@class='prodImage']/x:img">
    <xxx>
      <value-of select="@src"/>
    </xxx>

  <xsl:template match="text()"/>

</xsl:stylesheet>
Was it helpful?

Solution

Usually this kind of error doesn't appear for bad formatted XSLT file or for the syntax errors.

This is because of availability of XSLT file. Make sure that you have specified file name correctly. Try to access the file path you have specified from explorer or browser (This validates filepath as well as filename) .. Also file extension should be same as what you have specified. If you specify as *.xsl and actual file is *.xslt then it is not accessible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top