Subject: RE: [xsl] Testing if something is not there From: "Christopher Roe" <cpr@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 5 Nov 2001 22:29:57 -0000 |
The following does not use your key function, but does return sites hat have not run a given test. I have wrapped your snippet with an <xml> tag. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates select="xml/BuildStamp/Testing[count(Tests/Test/FullName[text()='SomeOtherTe stName'])=0]" /> </xsl:template> <xsl:template match="Testing"> <xsl:value-of select="SiteName/text()" /> </xsl:template> </xsl:stylesheet> This produces the output SomeOtherName which is the site that has no test with full name equal to 'SomeOtherTestName' Christopher Roe -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Miller, James V (CRD) Sent: 05 November 2001 20:18 To: 'Xsl-List (E-mail) Subject: [xsl] Testing if something is not there I have an XML file (snippet below) <BuildStamp> <Testing> <SiteName>SomeName</SiteName> <Tests> <Test> <FullName>SomeTestName</FullName> <Result>0</Result> </Test> <Test> <FullName>SomeOtherTestName</FullName> <Result>0</Result> </Test> </Tests> </Testing> </BuildStamp> <BuildStamp> <Testing> <SiteName>SomeOtherName</SiteName> <Tests> <Test> <FullName>SomeTestName</FullName> <Result>0</Result> </Test> </Tests> </Testing> </BuildStamp> I am re-grouping this information. For each "Test" (grouped by "FullName"), gather the results from each "SiteName". So the resulting XML will look like <Test> <Name>SomeTestName</Name> <Result> <SiteName>SomeName</SiteName> <Status>SomeExitStatus</Status> </Result> <Result> <SiteName>SomeOtherName</SiteName> <Status>SomeOtherExitStatus</Status> </Result> </Test> <Test> <Name>SomeOtherTestName</Name> ... </Test> I can achieve this result using xsl:key and the key() function. While difficult to grok, it is VERY FAST. Now the kicker. Not every "Test" is run on every "Site" (not every "Test/FullName" needs to appear under every "BuildStamp"). What I really want to do is "fill out" the Test elements, so that every BuildName/Site appears inside of every Test element. If the Site did not run the Test, then the "Status" will be set to "NA". Is there a fast way that I could iterate over the Site's that are NOT in the node-set returned by key()? The key I am using is <xsl:key name="TestNames" match="Test" use="FullName"/> I want to know what BuildStamp/SiteName combinations did not run a specified test. Jim Miller _____________________________________ Visualization & Computer Vision GE Corporate Research & Development Bldg. KW, Room C218B P.O. Box 8, Schenectady NY 12301 millerjv@xxxxxxxxxx <mailto:millerjv@xxxxxxxxxx> (518) 387-4005, Dial Comm: 8*833-4005, Cell: (518) 505-7065, Fax: (518) 387-6981 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Testing if something is not t, Miller, James V (CRD | Thread | Re: [xsl] Testing if something is n, Jeni Tennison |
RE: [xsl] How to emded JS into XSL , Max Dunn | Date | RE: [xsl] MS XML DOM question..., Chris Bayes |
Month |