This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: expression value not a node set on content match
- To: xsl-list at mulberrytech dot com
- Subject: Re: expression value not a node set on content match
- From: John Robert Gardner <jrgardn at emory dot edu>
- Date: Thu, 4 May 2000 13:09:49 -0400 (EDT)
- Reply-To: xsl-list at mulberrytech dot com
Okay, I _did_ get it, but I could do the "and" but had to instead do it in
two steps, selecting out with the $x (and I never succeeded with a a
@code='x' match, I just gambled that in all 80megs the text() sring would
be unique for any element and got lucky. Same then in second process for
the @code='g':
<xsl:template match="marc">
<xsl:copy>
<xsl:apply-templates mode="copy"
select="record[data_field/subfield=contains(., '21 (')]" />
</xsl:copy>
</xsl:template>
Before i depart this current form of existence otherwise describable as
human, I'd like to know a path syntax for the original goal of selecting
on both text() strings from same-name elments of @code='x' and @code'g'
simultaneously in one mathc. . . . and all the unrecognized operator and
such gibberish I was getting is, I'm sure related . . .
jr
=-=-=-=-=-=-=-=-=-==-=-=-=
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