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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL and preceding-sibling question 1

Status
Not open for further replies.

Gaelle

Programmer
Jun 20, 2001
62
0
0
FR
Hi !

I am trying to create a XSL to transform such an XML structure in HTML :
<FACT>
<TYPDET typ='N'>
<DCO cta='123' dde='1'/>
<DCO cta='456' dde='1'/>
<DCO cta='456' dde='2'/>
<DCO cta='789' dde='1'/>
</TYPDET>
<TYPDET typ='T'>
<DCO cta='123' dde='2'/>
<DCO cta='456' dde='1'/>
<DCO cta='456' dde='3'/>
<DCO cta='789' dde='1'/>
</TYPDET>
</FACT>

I am in a template based on the DCO tag (don't have the choice), what I want to do is : if the value of TYPDET changes, write a title like 'Part' + typ attribute.

My problem is, I don't manage to do the correct test on TYPDET when I am in my DCO template.

I have tried :
<xsl:when test=&quot;../preceding-sibling::TYPDET[position()=1]/@typ!=../@typ&quot;>
but it writes a title for each line of the second typdet paragraph.
I have tried other things I don't remember, but I never get what I want.

Please, help me !!!

Gaelle.
 
Try it at first with value-of and look what you're getting:

<xsl:value-of select=&quot;../preceding-sibling::TYPDET[1]/@typ/>
<xsl:value-of select=&quot;../@typ&quot;/>

after that compare it in a test of xsl:when.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top