This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Value-of, copy-of
- From: Mike Ferrando <mikeferrando at yahoo dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 27 Feb 2002 15:17:48 -0800 (PST)
- Subject: Re: [xsl] Value-of, copy-of
- Reply-to: xsl-list at lists dot mulberrytech dot com
Wendell,
Well, this really made my day!
I was rather close and doing better than I thought with the syntax.
I was working at it correctly, but did not think to use "self", I was
using "child".
<xsl:copy-of select="node()[not(child::C1007) and
not(child::C1011)]"/>
I found some other help, so I changed your xsl a bit to:
<xsl:copy-of select="./C1001/node()[.....]"/>
Thanks for the info, I needed it.
Mike F.
--- Wendell Piez <wapiez@mulberrytech.com> wrote:
> Mike,
>
> Ah, the reason this is tricky is ... it's tricky.
>
> If your context node is the C1001 (that is, you're in a template
> matching
> the C1001), then you want all children except the C1007 and C1011
> children.
>
> That would be:
>
> <xsl:copy-of select="node()[not(self::C1007) and
> not(self::C1011)]"/>
>
> This translates as "copy all child nodes that are not themselves
> C1001
> nodes and not C1011 nodes, either".
>
> This actually works out to be the same as
>
> <xsl:copy-of select="node()[not(self::C1007|self::C1011)]"/>
>
> The reason for this is that the expression
> (self::C1007|self::C1011) tests
> as true for any C1007 or C1011 node, but false for any other.
> That's
> because those two are the only kinds of nodes from which the union
> of these
> two XPath expressions (which both traverse the self:: axis),
> returns a
> node-set with any node in it.
>
> But that may be more than you wanted to know. :-)
>
> Cheers,
> Wendell
>
> At 05:21 PM 2/27/2002, you wrote:
> >Wendell,
> >thanks for your patience. Here is a sample (attributes removed for
> >simplicity):
> >
> >XML:
> ><SHOW>
> ><C1001>
> ><TITLE>I Picked a Daisy</TITLE> (ca. <UNITDATE>1960</UNITDATE>)
> >unproduced, lyrics by <PERSNAME>Alan Jay Lerner</PERSNAME>
> >
> ><C1007>Note: the collaboration between Rodgers and
> ><PERSNAME>Lerner</PERSNAME> was terminated, Lerner subsequently
> >completed the show with <PERSNAME>Burton Lane</PERSNAME> and it
> >became <TITLE>On a Clear Day You Can See Forever</TITLE>.</C1007>
> >
> ><C1011>see [Sketches for I Married an Angel]</C1011>
> ></C1001>
> ></SHOW>
> >
> >I want this:
> >
> ><TITLE>I Picked a Daisy</TITLE> (ca. <UNITDATE>1960</UNITDATE>)
> >unproduced, lyrics by <PERSNAME>Alan Jay Lerner</PERSNAME>
> >
> >Thanks,
> >Mike F.
> >
> >--- Wendell Piez <wapiez@mulberrytech.com> wrote:
> > > Mike F.:
> > >
> > > At 04:00 PM 2/27/2002, you wrote:
> > > >I would like to exclude some elements from my copy-of output.
> I am
> > > >trying to use a template with xsl:copy but I am still not
> finding
> > > the
> > > >correct syntax for not().
> > > >
> > > ><xsl:copy-of select="C1001/node()[not(child::C1007) and
> > > >not(child::C1010)]"/>
> > >
> > > This translates into English as "copy all nodes that are
> children
> > > of my
> > > C1001 children but that do not have C1007 children and do not
> have
> > > C1010
> > > children of their own".
> > >
> > > To be more explicit, I'm afraid we need to see a snippet of
> your
> > > source XML
> > > again, with a specification of which nodes you want to copy and
> > > which ones
> > > you don't. (Tell us in the natural language of your choice, and
> > > there's
> > > probably someone around who can translate it back into XPath.)
> > >
> > > But the ultimate solution to your problem is to master XPath.
> 'and'
> > > and
> > > 'or' operators, the not() function, etc., are all part of
> XPath.
> > >
> > > Cheers,
> > > Wendell
> > >
> > >
> > >
>
>======================================================================
> > > Wendell Piez
> > > mailto:wapiez@mulberrytech.com
> > > Mulberry Technologies, Inc.
> > > http://www.mulberrytech.com
> > > 17 West Jefferson Street Direct Phone:
> > > 301/315-9635
> > > Suite 207 Phone:
> > > 301/315-9631
> > > Rockville, MD 20850 Fax:
> > > 301/315-8285
> > >
>
>----------------------------------------------------------------------
> > > Mulberry Technologies: A Consultancy Specializing in SGML
> and
> > > XML
> > >
>
>======================================================================
> > >
> > >
> > > XSL-List info and archive:
> > > http://www.mulberrytech.com/xsl/xsl-list
> > >
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! Greetings - Send FREE e-cards for every occasion!
> >http://greetings.yahoo.com
> >
> > XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
>
>
======================================================================
> Wendell Piez
> mailto:wapiez@mulberrytech.com
> Mulberry Technologies, Inc.
> http://www.mulberrytech.com
> 17 West Jefferson Street Direct Phone:
> 301/315-9635
> Suite 207 Phone:
> 301/315-9631
> Rockville, MD 20850 Fax:
> 301/315-8285
>
----------------------------------------------------------------------
> Mulberry Technologies: A Consultancy Specializing in SGML and
> XML
>
======================================================================
>
>
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list