RE: [xsl] Checking external files based on the attribute value

Subject: RE: [xsl] Checking external files based on the attribute value
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Wed, 13 Aug 2008 09:32:28 -0400
> From: Ganesh Babu N [mailto:nbabuganesh@xxxxxxxxx]
> Sent: Wednesday, August 13, 2008 9:13 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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

Current Thread