cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping XPATH Document()

ralf_zimmerningkat3
Participant
0 Kudos

Hi all

I try to use  xpath document() in PI 7.11 xslt Mapping.

example:

<xsl:variable name="bla" select="document('')/*"></xsl:variable>

(only to test if the pi can find the file)

Error in PI

javax.xml.transform.TransformerException: com.sun.org.apache.xalan.internal.xsltc.TransletException: com.sun.org.apache.xalan.internal.xsltc.TransletException: java.io.FileNotFoundException:

why is it not possible to use xpath function document() with xalan xslt processor

regards

Accepted Solutions (1)

Accepted Solutions (1)

ralf_zimmerningkat3
Participant
0 Kudos

yes I know thanks using document()  will produce a call to the self document.

if we have in the archive other xslt files and   use

document('second.xml') we get the same error??

peter_wallner2
Active Contributor
0 Kudos

Hello Ralf,

I am not sure what you are trying to do... Can you elaborate please.

You have other XSLT files in the archive and try to call them with document('second.xml') - you mean document('second.xsl') - right?

Why do you not call other XSLT files in your archive by <xsl:include/> in your main XSLT?

Best regards,

Peter

udo_martens
Active Contributor
0 Kudos

HI Ralf,

with function document() you can bind a document into your target message. The xsl parser will search for the given XPath and - if the document is not available - throw that error. You can put there a relative path like ../folder/file.xml or a absolut path like C://folder/file.xml or even an url like http://server/folder/file.xml.

Your expression

<xsl:variable name="bla" select="document('')/*"></xsl:variable>

is completely wrong, you dont need quotes inside document, the path shouldnt be empty, outside document nothing is allowed and you cant use jokers.

Regards,

Udo

ralf_zimmerningkat3
Participant
0 Kudos

the error then will be java.io.FileNotFoundException: second.xml

Former Member
0 Kudos

Hi Udo,

I am importing xslt provided by third party for their xml validations. The xslt zip package consists of 1 .xsl which uses following kind of syntax to load 2 xsd and 2 xml files.

<xsl:variable name="codeList" select="document('StdCodeLists2012-1.xsd')"/>

The 2 xsd and xml files are also included in the same zip. When I extract the zip and execute at command line using msxsl kind of tool, it works fine. But when I import this xsl zip package in PI, I get a run-time exception that it cannot find the xsd file in path.

  • javax.xml.transform.TransformerException: com.sun.org.apache.xalan.internal.xsltc.TransletException: com.sun.org.apache.xalan.internal.xsltc.TransletException: java.io.FileNotFoundException: StdCodeLists2012-1.xsd

I tried modifying the xsl giving various paths like './StdCodeLists2012-1.xsd', 'archivename/StdCodeLists2012-1.xsd' etc. But the error remains same.

In PI imported archive, it does show a column 'Path'. But there is no way to edit the path.

Anyone faced similar problem? Any solution?

Regards,

Rohit.

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi Ralf,

the syntax should look like:

<xsl:variable name="bla" select="document(XPath to document)" />

Regards,

Udo

peter_wallner2
Active Contributor
0 Kudos

Hello Ralf,

I am not sure if document('') works. According to this page http://www.w3schools.com/xsl/func_document.asp you have to specify an object (filename) or node-set.

Maybe it works if you get the name from "DynamicConfiguration" by calling the java function from XSLT mapping. That value you pass to document().

Best regards,

Peter