Steve,
The trouble is here:
At 03:38 PM 12/31/2002, you wrote:
> <xsl:for-each select="descendant::question">
> <xsl:value-of select="text"/>
> <xsl:value-of select="reference"/>
> </xsl:for-each>
Since you have a single <question> descendant of the context node, the
context shifts to that; the stylesheet then puts out values of the sets of
"text" element children (select="text") and reference children
(select="reference").
However, the 'value-of' instruction you are using explicitly pulls out a
string value; since the string value of a set of nodes is defined (in XPath
1.0) as the string value of the first node in the set (in document order),
that's what you're getting: your first <text> followed by the first
<reference>.
I'd suggest junking the for-each instruction (it's doing nothing but
changing the context node) and instead saying in its place,
<xsl:apply-templates select="question/text"/>
which tells the processor to process (by applying templates to) *all* the
<text> children of the <question> children of the context node. Then write
another template for the text, as in
<xsl:template match="text">
<xsl:value-of select="."/>
<xsl:value-of select="following-sibling::reference[1]"/>
</xsl:template>
This time, for each text node its own value is reported (a string value of
a node set with one member: no problem), and then the value of its next
following reference element is reported.
The logic here assumes you have a straight text/reference/text/reference
sequence of simple pairs (no helpful wrappers). You will need to qualify it
further if your data is not so regular.
(Of course this could also be done within your for-each if you really wanted.)
I hope that helps,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)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