Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting repeating children out of Repeating Parent nodes, using xslt 1

Status
Not open for further replies.

DaveyDonno

Programmer
Apr 28, 2005
2
US
Hi guys

Heres my sample xml:
Question follows after

<DocumentItem>
<BillPart>
<PresentationTypeName>Group</PresentationTypeName>
<Description>Description 1 </Description>
<Narrative>Narrative 1</Narrative>
</BillPart>
<BillPart>
<PresentationTypeName>Delete ME!!!</PresentationTypeName>
<Description>Description 2</Description>
<Narrative>Narrative 2</Narrative>
</BillPart>

<BillPart>
<PresentationTypeName>Me then 2 more</PresentationTypeName>
<Description>Description 3</Description>
<Narrative>Narrative 3</Narrative>
</BillPart>

<BillPart>
<PresentationTypeName>Bill Part</PresentationTypeName>
<Description>Description 4</Description>
<Narrative>Narrative 4</Narrative>
</BillPart>
</DocumentItem>

ok what im trying to do is output the Desciption and Narrative Concatenated together for each BillPart

Heres is what i've got so far in my transform file


<xsl:template match='DocumentItem'>

<xsl:for-each select="BillPart">

<xsl:variable name = "des" select = "//Description[current()]"/>
<xsl:variable name = "nar" select = "//Narrative[current()]"/>

<xsl:variable name = "bl" select = "concat($des,'&#13;',$nar)"/>

<BillLine>
<xsl:value-of select="$bl"/>
</BillLine>

</xsl:for-each>

</xsl:template>

But it just pulls out the narr and description for the first billpart 4 times.

Is there some way to refer to Narr And desc nodes in the specific BillPart when it is in scope? Or any otherway of doing this?

Thanks in Advance

Dave


 
<xsl:template match='DocumentItem/BillPart'>

<BillLine>
<xsl:value-of select="concat(Description,Narrative)"/>
</BillLine>

</xsl:for-each>

</xsl:template>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top