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

Referencing parent element in XSL style sheet

Status
Not open for further replies.

DaveMc

IS-IT--Management
Jan 16, 2001
1
0
0
US
My xsl style sheet uses the syntax below to test for the value of the t attribute of the parent <list element:

------------
<xsl:when test=&quot;ancestor::LIST/@T=B'&quot;><xsl:text disable-output-escaping=&quot;yes&quot;>&St;hi&St;</xsl:text></xsl:when> <xsl:eek:therwise></xsl:eek:therwise></xsl:choose>
<xsl:text disable-output-escaping=&quot;yes&quot;></xsl:text>

<xsl:choose><xsl:when test=&quot;ancestor::LIST/@T='OB'&quot;><xsl:text disable-output-escaping=&quot;yes&quot;><dd> </xsl:text>
</xsl:when> <xsl:eek:therwise></xsl:eek:therwise> </xsl:choose>
------------

The problem is that my data allows nested lists, and the above syntax checks all ancestors called <list> of a given element, not just the parent.

I need the style sheet to check the t attr of the parent <list> element, and ignore any grandparent (or higher) <list>.

Thank you! :)

DAVE
 
Hello Dave.

Try this code:

...test=&quot;parent::LIST/@T=...&quot;...

I don't run it on MSXML but on Sablotron it works perfectly.
Hope it will relieve.

Avator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top