Re: [xsl] value-of select problem

Subject: Re: [xsl] value-of select problem
From: Chad Chelius <cchelius@xxxxxxxxxxxxxxx>
Date: Wed, 16 Aug 2006 09:29:56 -0400
Thanks Michael, that worked! Could you elaborate a bit on how this rule is working?

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

-----Original Message-----
From: cchelius@xxxxxxxxxxxxxxx [mailto:cchelius@xxxxxxxxxxxxxxx]
Sent: 15 August 2006 22:35
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] 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:



XSLT Sample:

  <xsl:for-each select="Story/author/authorFname">
                        <!-- Adjusted to allow for multiple
authors -->
                                <xsl:value-of select="."/>

Current Thread