Hello,
I have searched the forums and can't seem to find a fix for my need yet. I am stepping through an XML document and trying to pull the content (text) of two siblings together into one.
First the data:
Code:
<Body>
<Para>ARTICLE 1</Para>
<Para>BILL OF RIGHTS</Para>
<otherNode>other text</otherNode> . . .
I am creating a single element node with the text of the Para's concatenated and centered. So I want my output to be like this:
<Para Justify="Center">ARTICLE 1 BILL OF RIGHTS</Para>
I match on the first Para, start building my element, and then bring in the text. Here's my attempt:
Code:
<xsl:template match="Para">
<xsl:element name="Para">
<xsl:attribute name="Justify" select="'Center'"/>
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
<xsl:value-of select="following-sibling::*[1]" />
</xsl:element>
</xsl:template>
I receive an error on the following-sibling line above, the error is "Error in XPath 2.0 expression (Not a node item)". I have tried multiple efforts based on tips from this forum, including 'following-sibling::Para[1]' and 'following-sibling::*[position()=1]' and even 'Para[1]/text()' all to no avail.
Are there any suggestions? I'd like to think I'm at least 'close'. Thank you in advance for any and all assistance.
Dan