Subject: Sibling text() Content Match [was: Re: expression value not a node set on content match] From: John Robert Gardner <jrgardn@xxxxxxxxx> Date: Thu, 4 May 2000 13:40:03 -0400 (EDT) |
Okay, at risk of boring everybody -- I found a way to get both test strings from two siblings selected in one match . . . (still not with @code matches, but narrowed down with both criteria below, even in 80 megs there's no duplicates): <xsl:apply-templates mode="copy" select="record[data_field/*= contains(., '21 (') and ../*=contains(., '0141-6200')]" /> I guess I thought this was a useful XPath match to send along and, since I'm always just missing it and folks like Mike, Michael, and David are helping me out, I just wanted to reassure that I sometimes do actually figure these out, and the lessons from the bards and guru's herein have helped and not fallen on deaf ears. :-) =-=-=-=-=-=-=-=-=-==-=-=-= John Robert Gardner, Ph.D. XML Engineer Emory University ------------------------------------------------------------ http://vedavid.org/diss/ "If there is something you're thinking of doing, or wish you could do, begin it. In boldness there is mystery and power . . . . " -Goethe On Thu, 4 May 2000, John Robert Gardner wrote: > Sorry, but this still isn't getting it, and the "and" is repeated too . . > see note below (I'm now getting unrecognized operator pointing to my > "xsl:apply-templates line" from XT)" > > On Wed, 3 May 2000, Mike Brown wrote: > > > > and I only want ot pull out those few <record>'s with given content in > > > data-field[@tag='773']/subfield[@code='g'] --in other words a > > > record with text string 0000-1234 in subfield[@code='g'] of > > > data-field[@[tag='773'] ALONG WITH a test string of say "21 " (note the > > > space- do I use &#?) in subfield[@code='x'] of same datafield[@tag='773'] > > > in that record, what gives? I'm using > > > > > > <xsl:apply-templates select="record[*[@tag='773']/*[@code='g' > > > [contains(., '21 ')]] > > > and record[*[@tag='773']/*[@code='x' > > > [contains(., '0141-6400')]]"/> > > > > It is complaining because you are putting a predicate -- something, i.e. > > contains(., 'foo'), in brackets -- after what is either a string object > > ('g') or a boolean object (@code='g'), but a predicate is something that > > can only modify a node-set. > > Okay, this make sense, so, per you below, I tried (b/c @x and @g are both > attributes of the children of the element with @773 wherein the required > text string on which to match is found: > > > <xsl:template match="/"> > <xsl:copy-of > select="record[ @tag='773'/*[@code='g' > contains(text(),'21 ') > and *[ @code='x' > and contains(text(),'0141-6400') ] > ]" /> > </xsl:template> > > Note: I've tried to replace copy-of with "apply-templates" wrapped in > xsl:copy, and still problems . . . > > sorry, I am just not getting this, and the syntax for the Path is really > screwing me up. > > jr > > > > > > Try something like this (copious whitespace only here for clarity): > > > > select="record[ @tag='773' > > and contains(.,'21 ') > > and *[ @code='x' > > and contains(.,'0141-6400') ] > > ]" > > > > As for the space in the 21, it doesn't matter if you use a literal > > character or a numeric character reference. If it's a regular space just > > type a regular space from your keyboard. If it's a non-breaking space you > > can probably use a keyboard trick to produce that character (alt-0160 on > > NT, for example), or you could use  . > > > > - Mike > > ___________________________________________________________ > > Mike J. Brown, software engineer, Webb Interactive Services > > XML/XSL stuff: http://www.skew.org/ http://www.webb.net/ > > > > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > > > > 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 -> |
---|---|---|
Re: expression value not a node set, David Carlisle | Thread | Re: Sibling text() Content Match [w, David Carlisle |
Has anyone played around with BizTa, Michael J. Hudson | Date | Re: I LOVE YOU virus, Matt Sergeant |
Month |