This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Novice question: selecting an element based on an attribute id
- From: Peter Davis <pdavis152 at attbi dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 21 Mar 2002 03:01:26 -0800
- Subject: Re: [xsl] Novice question: selecting an element based on an attribute id
- References: <001001c1d0b4$f2a90b60$655169d5@pcukmka>
- Reply-to: xsl-list at lists dot mulberrytech dot com
On Thursday 21 March 2002 00:46, Michael Kay wrote:
> > Anyway, the transformation is:
> > 1. Look for elements in the source with the attribute
> > "field" and use that as an element in the target. Hence, you see that
> >
> > <String field="_str1" myId="28"><![CDATA[a test of
> > referencing.]]></String>
> >
> > becomes
> >
> > <_str1><![CDATA[a test of string referencing.]]></_str1>
>
> So what are the criteria that turn the value "a test of referencing" into
> "a test of string referencing"? I still don't understand.
>
> Michael Kay
<_str1> is a tag with a value and id "28". <_str3> is a tag that references
the value of the tag with id "28" via refid="28".
So since the value of <String field="_str1"> was "<![CDATA[a test of string
referencing.]]>" (ignoring the fact that the CDATA won't be copied), <_str3>
also gets a copy of this value because it references _str1.
I believe his input document is output from the JSX project -- Java
Serialization to XML (but I could be wrong). As you probably know, in
serialization each object is only written once, and future references to the
same object use a reference id, to prevent both wasted space and infinitely
recursive graphs. So that would be where he's getting the refid="28" and why
he want's a copy of the value (since they started out as the same
object/value).
--
Peter Davis
By rule #1, 5.005 should always allow localization of lexical @_ . . .
-- Larry Wall in <199710011704.KAA21395@wall.org>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list