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

RE: value-of select problem

Subject: RE: value-of select problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 16 Aug 2006 14:58:20 +0100
xsl value of select value
> Thanks Michael, that worked! Could you elaborate a bit on how 
> this rule is working?

(a) following-sibling::*       all the following siblings
(b) [self::Mname|self::Lname]  all the following siblings whose name is
Mname or Lname
(c) [1]                        the first node in (b)
(d) [self::Mname]              the node selected by (c) if it is named
Mname, or nothing if it isn't

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: Chad Chelius [mailto:cchelius@xxxxxxxxxxxxxxx] 
> Sent: 16 August 2006 14:30
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  value-of select problem
> 
> 
> 
> On Aug 15, 2006, at 6:54 PM, Michael Kay wrote:
> 
> > It's similar to another thread today called "Wrapping Problem" - 
> > usually called positional grouping.
> >
> > Try following-sibling::*[self::Mname|self::Lname][1][self::Mname]
> >
> > That's the first following sibling that's an Mname or an Lname, 
> > provided it's an Mname.
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >
> >> -----Original Message-----
> >> From: cchelius@xxxxxxxxxxxxxxx [mailto:cchelius@xxxxxxxxxxxxxxx]
> >> Sent: 15 August 2006 22:35
> >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >> Subject:  value-of select problem
> >>
> >> I have included a snippet from my xslt that I am having 
> difficulties 
> >> with.
> >> My source XML can contain several authors names but those 
> names don't 
> >> have to contain a middle name. The problem with my xslt is 
> that when 
> >> an author doesn't contain a middle name it will pull the 
> middle name 
> >> from the next author after it.
> >> Obviously this is no good as it creates a name that is 
> incorrect. I'm 
> >> not sure how to tell the xslt that if there is no middle 
> name not to 
> >> grab <authorMname from the next author.
> >> Any ideas?
> >>
> >> XML Code Sample:
> >>
> >> <author><authorFname>John</authorFname>
> >>             <authorLname>Dai</authorLname>, 
> >> <authorDegree>MD</authorDegree>;
> >>
> >> <authorFname>Jane</authorFname><authorMname>Austin</authorMnam
> >> e><authorLname>Smith</authorLname></author>
> >>
> >>
> >> XSLT Sample:
> >>
> >>   <xsl:for-each select="Story/author/authorFname">
> >>                         <!-- Adjusted to allow for 
> multiple authors 
> >> -->
> >>                         <Author>
> >>                             <FirstName>
> >>                                 <xsl:value-of select="."/>
> >>                             </FirstName>
> >>                             <MiddleName>
> >>                                 <xsl:value-of 
> >> select="following-sibling::authorMname[1]"/>
> >>                             </MiddleName>
> >>                             <LastName>
> >>                                 <xsl:value-of 
> >> select="following-sibling::authorLname[1]"/>
> >>                             </LastName>
> >>                             <Suffix>
> >>                                 <xsl:value-of 
> >> select="following-sibling::authorSuffix[1]"/>
> >>                             </Suffix>
> >>                             <Affiliation>
> >>                                 <xsl:value-of 
> >> select="following-sibling::authorAffiliation[1]"/>
> >>                             </Affiliation>
> >>                         </Author>
> >>                     </xsl:for-each>

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.