[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re: Re: <xsl:choose> or variable syntax incorrect

Subject: RE: Re: Re: <xsl:choose> or variable syntax incorrect?
From: "Kathy Burke" <Kathy_Burke@xxxxxxxxx>
Date: Fri, 26 Sep 2003 15:51:30 -0400
xml variable syntax
Sorry, I'm tired so I typed my xml source incorrectly...ditto for the row
color...it is correct on my side...but you would have no way of knowing
that! I'll go away now. Sorry.

Hope you have a good weekend.

Kathy

-----Original Message-----
From: Dimitre Novatchev [mailto:dnovatchev@xxxxxxxxx]
Sent: Friday, September 26, 2003 3:51 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Re: Re: <xsl:choose> or variable syntax incorrect?


Kathy,


"Kathy Burke" <Kathy_Burke@xxxxxxxxx> wrote in message
news:395DE57EA5BB7F4E952B7B89775350B5021E4209@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> First, I truly appreciate your responding. But please tell me how I did
not
> "explain the problem I've solving"? I honestly thought I did!
>
> <station name='StationOne'>
> <boards>
>    <board sn='123'/>
>    <board sn='124'/>
> </boards>
> </station>
>
> If there are no <board> elements in the <station> element, I would like to
> have a blue row with the value-of the <station> name attribute as text:
>
> -----------------------------------
> Station One  (in red text)
> -----------------------------------

The confusion starts here: you say you'd have the row in blue, but present a
row in red! ???

>
> Otherwise, I would like the same text (Station One) but in a blue row.

More confusing -- if something, then the row in blue, else the row (again)
in blue ... ???

>
> I still don't understand why this doesn't work:
>
> <xsl:template match="Station">

This template  will not get instantiated at all -it mathces "Station" while
in your source.xml you have "station" elements. XPath is case-sensitive,
which means that "station" and "Station" are different names.

>
> <xsl:variable name="boards"
select="//Station[name='@name']/Boards/Board"/>

This has a zero chance of selecting anything, because the predicate will be
true only if the some "Station" element (of which there are zero in your
xml.source has a "name" child which has value equal to the string '@name'.
But t there are no "name" elements at all in your source.xml. And probably
you did not mean to find "name" elements that have the same value (the
constant string '@name').

All this makes any further analysis almost impossible.

[skip]

> Although it doesn't work, why is it SO dreadful? If I could correctly
return
> the variant I need (are there boards for this station?) wouldn't the rest
be
> ok?

Probably yes, but how can you expect that somebody will be reading this code
so far? The first part of the code contains illogical and obviously
erroneous expressions and these prevent anyone from understanding what in
the first place you were trying to do... Therefore, why would anyone
continue reading further?


>
> I came up with this either out of books or from the MANY examples I've
read
> on the newsgroups.
>
> I have read Jeni's book (and M. Kay's as well). Unfortunately, that
doesn't
> mean I've absorbed it all :-?

These books are not to be absorbed -- they are to be understood. They have
examples and exercises, which if followed and worked out ensure that the
reader would have a correct understanding and practical experience with the
topics discussed.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.