xml


value-of select=“document($path)/ns0:element1/ns0:element2” returns NULL with SAXON-B XSLT 2.0 (saxon9)


The getdetails.xslt code (XSLT 2.0) below reads the contents of user-config.xml via a document().
The code successfully works against Saxon 9.4.0.6 and the value of ns0:project_abs_path is visible in the xml output as shown below
<?xml version = "1.0" encoding = "UTF-8"?>
<xmlString><?xml version="1.0" encoding="UTF-8"?> C:\myProject</xmlString>
However, the below xml output (NOTE:no value for ns0:project_abs_path) is returned when the same XSLT code is run against SAXON-B XSLT 2.0 (saxon9) in TIBCO Transform Activity.
<?xml version = "1.0" encoding = "UTF-8"?>
<xmlString><?xml version="1.0" encoding="UTF-8"?></xmlString>
*There is no error returned.
user-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<ns0:userRules xmlns:ns0="http://www.tibco.com/schemas/-bw/SharedResources/Schema.xsd">
<ns0:project_abs_path>C:\myProject1</ns0:project_abs_path>
</ns0:userRules>
getdetails.xslt
<?xml version='1.0'?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ns0="http://www.tibco.com/schemas/bw/SharedResources/Schema.xsd"
xmlns:ns1="http://www.tibco.com/schemas/bw/SharedResources/rule-db.xsd">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:param name="invar_ruleid"/>
<xsl:variable name="var_installation_path">C:\FOLDER</xsl:variable>
<xsl:variable name="var_user_config_path" select="concat($var_installation_path,'\bin\user-config.xml')"/>
<xsl:variable name="var_project_abs_path" select="document($var_user_config_path)/ns0:userRules/ns0:project_abs_path"/>
<xsl:variable name="file">file:///</xsl:variable>
<xsl:variable name="var_out_file_path" select="concat($file,$var_project_abs_path)"/>
<xsl:template match="/">
<xsl:value-of select="document(concat($var_installation_path,'\bin\user-config.xml'))/ns0:userRules/ns0:project_abs_path"/>
</xsl:template>
</xsl:stylesheet>
Saying "A NULL is returned" is a very vague. Could you be more explicit? Are you seeing an exception, or a Saxon error message, or incorrect transformation results? If you see an exception, could you show the stack trace? If you see a Saxon error message, could you tell us what it is?
The only thing obviously wrong with your code is that you are constructing a Windows filename (in the form "c:\a\b\c") and passing this to the document() function, which expects a URI. In theory this is always wrong, but some applications tolerate it. You should be passing a URI of the form "file:///c:/a/b/c". I have no idea whether this is the cause of the problem.

Related Links

Specifying pubDate for previous RSS Feed Items
build two build xml files using a single ant script
How to deserialize 2 elements into one type, then serialize back to only 1 element
My website sitemap.xml file suddenly includes thousands of spam links of my own domain
“Envelope namespace was unexpected” error in .NET WSDL endpoint hosted in Mulesoft
XML document transforms using XSLT to GraphML in a single line
Sed substitutes just once instead of multiple times
Error: Attribute and namespace nodes cannot be added to the parent element
Saving SAS programs in XML format
XML xPath with apostrophes trouble
Handle spaces in xml interface parameter passing
How can i select a tag and copy every child expect something and give a new parent
xml syntax highlighting vim colorscheme fix
string length to find length in a Schematron
Extracting data from XML tag
FOR XML low performance in query plan using TYPE

Categories

HOME
google-app-engine
assembly
awk
google-spreadsheet
angular-formly
flex
themes
knitr
google-cloud-functions
nsbundle
hpc
echo
elasticsearch-5
categorical-data
openbugs
heat
do-while
dreamweaver
asp.net-mvc-viewmodel
html5-appcache
smartclient
solrcloud
sar
blade
react-toolbox
exchangewebservices
comparable
uitapgesturerecognizer
sqlpackage
kodi
github3.py
jwplayer6
engine.io
salesforce-communities
projects-and-solutions
ogc
datacachefactory
escpos
movilizer
httr
opencmis
spring-integration-sftp
mschart
zenhub
corruption
bootstrap-tags-input
polyline
slackware
google-cloud-console
iotivity
freepbx
stream-processing
upx
httpruntime.cache
mobiledoc-kit
gocql
pax-exam
amiga
android-broadcast
bcache
gamekit
execve
deform
post-commit-hook
cancellation
decoupling
twitter-bootstrap-rails
synapse
android-usb
jammer
breakout
away3d
wp7test
preload
asplinkbutton
midlet
subgraph
inkcanvas
jdb
saxparseexception
google-ajax-api
webdev.webserver
multiplatform
inline-formset
mtu
squishit
resharper-6.0
vs-android
dot-emacs
django-piston
alsb
firefox-3
flvplayback
ifilter
great-circle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App