From: Ganesh Babu N [mailto:nbabuganesh(_at_)gmail(_dot_)com]
Sent: Wednesday, August 13, 2008 9:13 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Checking external files based on the attribute value
Dear All,
I am having an XML file in which I am having the following coding
<graphic picfile="I970106058X_bulb"/>
All the graphic filenames are stored in a separate XML file the
contents are:
filelist.xml
<files>
<file>./970106058X_c01_0002.tif</file>
<file>./970106058X_c01_0001.tif</file>
<file>./970106058X_bulb.tif</file>
<file>./970106058X_0000.tif</file>
<file>./970106058X_c01_0003.tif</file>
</files>
Now my task is to search the filelist.xml for @picfile value and if it
is not found raise an error.
I am using the following code:
boolean(document('filelist.xml')/files/file[contains(.,
substring-after(concat(@picfile,'.tif'),'I'))] )
In your example the URI you are testing for in your XPath expression is
"970106056X_bulb.tif", but the URI in your file list XML is
"./970106058X_bulb.tif". It looks like you need to account for the "./". Try
the following XPath expression:
boolean(document('filelist.xml')/files/file[. =
concat('./',substring-after(concat(@picfile,'.tif'),'I'))])
Andy
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--