Subject: Re: [xsl] Checking external files based on the attribute value From: "Darcy Parker" <darcyparker@xxxxxxxxx> Date: Thu, 14 Aug 2008 09:33:17 -0400 |
Hi Ganesh, As mentioned by others, the Schematron Mailing List doesn't receive many postings... but it is a good forum to ask questions. http://www.eccnet.com/mailman/listinfo/schematron To me it seems like you just need practice thinking about and writing XPath expressions. Others here and on the Schematron mailing list can probably help with XPath statements if you get stuck. FYI on other applicable resources: I first learned about Schematron in chapter 16 of "Beginning XSLT" by Jeni Tennison. It was an excellent introduction with many example XPaths to study. I was disappointed that this chapter on schematron was removed from the more recent edition of her book on XSLT. If you can locate a copy of the first edition "Beginning XSLT", I recommend it. (It will probably be cheaper because it is only available used.) The O'Reilly XSLT 2.0 Cookbook also has a chapter with example XPath expressions that I found a useful learning tool. Dave Pawson also wrote an excellent tutorial on Schematron. http://www.dpawson.co.uk/schematron/ Darcy On Thu, Aug 14, 2008 at 12:00 AM, Ganesh Babu N <nbabuganesh@xxxxxxxxx> wrote: > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Checking external files b, Ganesh Babu N | Thread | Re: [xsl] Checking external files b, Ganesh Babu N |
Re: [xsl] position and loop problem, henry human | Date | [xsl] understanding generate-id an, christoph . naber |
Month |