[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Checking external files based on the attribute val

Subject: Re: Checking external files based on the attribute value
From: "Ganesh Babu N" <nbabuganesh@xxxxxxxxx>
Date: Thu, 14 Aug 2008 09:30:48 +0530
Re:  Checking external files based on the attribute val
Dear Darcy,

I am writing an schematron and i struck in this case. I did not found
any forum which is providing help on schematron. As the schematron is
based on XSLT and XPath I am raising the questions here.

Thanks once again for you ready made solution for me.

Regards,
Ganesh


On 8/13/08, Darcy Parker <darcyparker@xxxxxxxxx> wrote:
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.