Subject: Re: [xsl] Filtering sequences of atomic types|
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 26 Nov 2008 15:45:33 -0500
I'm trying to filter a sequence using a predicate that involves a node set. What I actually want to do is something like
$string-sequence[. = //@xml:id]
i.e. get all items of a sequence that occur as an xml:id attribute somewhere in the document.
As that gives me the error message "XPTY0020: Cannot select a node here: the context item is an atomic value" (with Saxon 9.1), I tried
$string-sequence[. = (for $n in (//@xml:id) return xs:string($n))]
('foo', 'bar')[. = (for $n in (//@name) return 'foo')]
where the latter should actually return something like ('foo', 'foo', ...), and ('foo', 'bar')[. = ('foo', 'foo')] works, of course.
My current workaround is translating the string sequence to a sequence of text nodes, but why doesn't it work with a sequence of atomic types?
<xsl:variable name="tree" select="/"/> <xsl:for-each select="$string-sequence[.=$tree//@xml:id]"> ...
<xsl:for-each select="//@xml:id[.=$string-sequence]"> ...
-- Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes: : Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|<- Previous||Index||Next ->|
|RE: [xsl] Filtering sequences of at, Michael Kay||Thread||Re: [xsl] Filtering sequences of at, Christoph LANGE|
|RE: [xsl] Filtering sequences of at, Michael Kay||Date||Re: [xsl] Filtering sequences of at, Christoph LANGE|