Subject: Re: [xsl] Checking external files based on the attribute value From: "Darcy Parker" <darcyparker@xxxxxxxxx> Date: Wed, 13 Aug 2008 09:40:07 -0400 |
Hi Ganesh, There are a few problems with your expression... The predicate is: contains(.,substring-after(concat(@picfile,'.tif'),'I')) Note: There is no @picfile attribute in the document('filelist.xml')/files/file elements... so concat(@picfile,'.tif') is going to just return '.tif'. I don't think you need boolean() I am assuming your are running the XSL with <graphic picfile="I970106058X_bulb"/> in your input XML. I am not sure the context you are calling the expression that checks for the presence of the slightly modified @picfile value in filelist.xml... So the following is a guess along with a suggested new expression: <xsl:for-each select="//graphic/@picfile"/> <xsl:variable name="Currentpicfile" select="."/> <xsl:choose> <xsl:when test="document('filelist.xml')/files/file[contains(.,substring-after(concat($Currentpicfile,'.tif'),'I'))]"> Good </xsl:when> <xsl:otherwise> Bad </xsl:otherwise> </xsl:choose> </xsl:for-each> Note: This type of check is what Schematron is excellent at... <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://purl.oclc.org/dsdl/schematron" xmlns:iso="http://purl.oclc.org/dsdl/schematron" schemaVersion="Test1.0"> <title>Example</title> <let name="RVPStructure" value="doc(concat($RVPDITABranchHomeURL,'/wbs_precompose/ExpandedRVPStructure.xml'))"/> <pattern id="GeneralExecutionSteps.Checks"> <title>Example Pattern</title> <rule context="//graphic/@picfile"> <let name="Currentpicfile" value="."/> <assert test="document('filelist.xml')/files/file[contains(.,substring-after(concat($Currentpicfile,'.tif'),'I'))]">Error @picfile="<value-of select="."/>" does not exist in filelist.xml</assert> </rule> </pattern> </schema> Darcy On Wed, Aug 13, 2008 at 9:12 AM, Ganesh Babu N <nbabuganesh@xxxxxxxxx> wrote: > > 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'))] ) > > But i am not getting any message. Please help me how to achieve this task. > > Regards, > Ganesh
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Checking external files b, Peter Hickman | Thread | Re: [xsl] Checking external files b, Ganesh Babu N |
Re: [xsl] Checking external files b, Peter Hickman | Date | [xsl] Re: XPath Against OpenXML and, Laura Porter |
Month |