How to pass Java ArrayList to XSLT 2.0
Added by Anonymous over 14 years ago
Legacy ID: #8538541 Legacy Poster: Jack Bush (netbeansfan)
Hi Michael, Looks like the threat is a Saxon specific question so I will start using Saxon-Help for the remaining question. The following error has been generated when declaring the parameter LIST_OF_FILE_PARAM on top of existing masterdox1.xsl: Error at xsl:param on line 9 column 81 XPST0081: SequenceType syntax error at char 0 in {xs:string*}: Undeclared namespace prefix {xs} 30/07/2010 1:45:48 PM XSLTTransformation masterdox1 SEVERE: null javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected. at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:176) at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:139) at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:91) at XSLTTransformation.masterdox1(XSLTTransformation.java:99) at XSLTTransformation.main(XSLTTransformation.java:39) Also updated stylesheet version at the top of masterdox1.xsl from 1.0 to 2.0 and was able to run it properly prior to declaring LIST_OF_FILE_PARAM. Below is the code snippet of XSLTTransformation.java again: 99 Transformer transformer = transformerFactory.newTransformer(new StreamSource(masterdox1StyleSheetBrIn)); 100 secondaryArrayList.add("file:///E:/fileA.xml"); 101 secondaryArrayList.add("file:///E:/fileB.xml"); 102 secondaryArrayList.add("file:///E:/fileC.xml"); 103 secondaryArrayList.add("file:///E:/fileD.xml"); 104 transformer.setParameter("LIST_OF_FILE_PARAM", secondaryArrayList); I have always had compilation error when declaring types in Saxon 9.1 XSLT 2.0. Btw, would you recommend that I should use the latest Saxon-HE instead of staying with 9.1. If so, do you provide advice on how to compile Saxon-HE source code to support JDOM extension? Alternatively, is version 9.1 stable and that there is no need to upgrade to Saxon-HE considering that Saxon-HT doesn't support JDOM extension? Thanks a lot, Jack
Replies (2)
RE: How to pass Java ArrayList to XSLT 2.0 - Added by Anonymous over 14 years ago
Legacy ID: #8538805 Legacy Poster: Michael Kay (mhkay)
Like any namespace prefix, you can only use the name xs:string in your stylesheet if you declare the namespace, in this case xmlns:xs="http://www.w3.org/2001/XMLSchema". >Btw, would you recommend that I should use the latest Saxon-HE instead of staying with 9.1. If so, do you provide advice on how to compile Saxon-HE source code to support JDOM extension? My advice here is to move to Saxon-PE 9.2. But of course, it's entirely biased advice! For those who want to save themselves £50, the options are to stay with 9.1 or to take the do-it-yourself route and build the JDOM module for 9.2 HE - I deliberately left that option available for people who have more time than money.
RE: How to pass Java ArrayList to XSLT 2.0 - Added by Anonymous over 14 years ago
Legacy ID: #8547878 Legacy Poster: Jack Bush (netbeansfan)
Hi Michael, Thank you for advicing on passing Java ArrayList to XSLT stylesheet which is working beautifully. There is no need to use shematic awared features in Saxon-PE 9.2 hence Saxon 9.1 is sufficient for my needs which include JDOM extension at no cost. Thanks again, Jack
Please register to reply