xsl-list
[Top] [All Lists]

[xsl] value-of select problem

2006-08-15 14:35:24
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</authorMname><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>







--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>