Subject: Re: [xsl] Could not read secondary source document in XSLT stylesheet From: Jack Bush <netbeansfan@xxxxxxxxxxxx> Date: Mon, 19 Jul 2010 00:14:53 -0700 (PDT) |
Hi David, B Thanks for your advice and the issue with missing </xsl:template> has been resolved. However, a different error even though Apache catalog resolver has been setup and is working in the same application yet Saxon 9.1 XSLT 2.0 processor seems to indicate that it is not picking up the e:/xhtml1-transitional.dtd file supplied: Parse catalog: ///e:/catalog.xml Loading catalog: ///e:/catalog.xml Default BASE: file:/e:/catalog.xml xml:base: file:///E:/ BASE STR: file:///E:/ override: no OVERRIDE: no public: -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd PUBLIC: -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd system: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd xhtml1-transitional.dtd SYSTEM: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd file:/E:/xhtml1-transitional.dtd system: xhtml1-transitional.dtd xhtml1-transitional.dtd SYSTEM: xhtml1-transitional.dtd file:/E:/xhtml1-transitional.dtd uri: corporationStyleSheet.xsl corporationStyleSheet.xsl URI: corporationStyleSheet.xsl file:/E:/corporationStyleSheet.xsl (reset) xml:base: file:/e:/catalog.xml BASE STR: file:/e:/catalog.xml resolveSystem(http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd) Resolved system: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd file:/E:/xhtml1-transitional.dtd resolveSystem(file:/E:/xhtml-lat1.ent) resolvePublic(-//W3C//ENTITIES Latin 1 for XHTML//EN,file:/E:/xhtml-lat1.ent) resolveSystem(file:/E:/tmp/xhtml-symbol.ent) resolvePublic(-//W3C//ENTITIES Symbols for XHTML//EN,file:/E:/xhtml-symbol.ent) resolveSystem(file:/E:/tmp/xhtml-special.ent) resolvePublic(-//W3C//ENTITIES Special for XHTML//EN,file:/E:/xhtml-special.ent) Recoverable error on line 10 FODC0002: java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd Exception in thread "main" java.lang.IllegalStateException: Root element not set at org.jdom.Document.getContent(Document.java:408) at org.jdom.output.XMLOutputter.output(XMLOutputter.java:369) at org.jdom.output.XMLOutputter.output(XMLOutputter.java:203) at CorporationBean.java:275) B C:/CorporationBean.java is made up of the following code snippets: ....... 271 TransformerFactory transformerFactory = new net.sf.saxon.TransformerFactoryImpl(); 272 Transformer transformer = transformerFactory.newTransformer(new StreamSource(new File(e:/corporationStyleSheet.xsl))); 273 JDOMSource mainSource = new JDOMSource(primaryjdomDocument); 274 JDOMResult mainResult = new JDOMResult(); 275 transformer.transform(mainSource, mainResult); ..... B The following e:/corporationStyleSheet.xsl has been simplified: E:/corporationStyleSheet.xsl 1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 <xsl:stylesheet version="1.0" 3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:ns="http://www.w3.org/1999/xhtml" 5 exclude-result-prefixes="ns"> 6 7 <xsl:output method="xml" omit-xml-declaration="yes"/> 8 <xsl:strip-space elements="*"/> 9 <xsl:template match="/"> 10 <xsl:apply-templates select="document('///C:/STAFF.xml')/ns:employee"/> 11 </xsl:template> 12 13 <xsl:template match="ns:employee"> 14 <firstname><xsl:value-of select="ns:firstname"/></firstname> 15 <surname><xsl:value-of select="ns:surname"/></surname> 16 <age><xsl:value-of select="ns:age"/></age> 17 </xsl:template> 18 </xsl:stylesheet> c C:/STAFF.xml is made up of the following data snippet:<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">< <firstname>John</firstname> <surname>Smith</surname> <age>25</age> ......employee xmlns="http://www.w3.org/1999/xhtml" xmlns:html="http://www.w3.org/1999/xhtml"></employee> B E:/Catalog.xml<?xml version="1.0"?> <!DOCTYPE catalog PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <group prefer="system" xml:base="file:///E:/" > B <public B B B B B publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" B B B B B uri="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> B <system B B B B B systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" B B B B B uri="xhtml1-transitional.dtd"/> B <system B B B B B systemId="xhtml1-transitional.dtd" B B B B B uri="xhtml1-transitional.dtd"/> B <uri B B B B B name=" B B B B B uri=" </group> </catalog>corporationStyleSheet.xsl"corporationStyleSheet.xsl"/>c This issue still persists even while running it online having Internet connection to www.3g.org. Is it necessary to setup catalog lookup within e:/corporationStyleSheet.xsl? If so, how to? B Thanks a lot again, Jack ----- Original Message ---- From: David Carlisle <davidc@xxxxxxxxx> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Sent: Thu, 15 July, 2010 12:40:07 AM Subject: Re: [xsl] Could not read secondary source document in XSLT stylesheet On 14/07/2010 15:32, Jack Bush wrote: > 10<xsl:template match="employee"> > 11<xsl:apply-templates select="document('C:\\STAFF.xml')"/> > 12<xsl:template match="/ns:employee"> as it said in teh error message you quoted, you can not nest templates. You have 10 <xsl:template match="employee"> 11 <xsl:apply-templates select="document('C:\\STAFF.xml')"/> 12 <xsl:template match="/ns:employee"> you need and </xsl:template> on line 12 also saxon may be forgivinbg these days but C:\\STAFF.xml should be a URI so file:///STAFF.xml David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Could not read secondary , David Carlisle | Thread | [xsl] Versioned Namespaces, Andy Chambers |
RE: [xsl] XSL Function adjustColumn, Mauritz Jeanson | Date | Re: [xsl] A question of style, Wendell Piez |
Month |