How to select ancestor based on ancestor's attribute

Posted by kman on Stack Overflow See other posts from Stack Overflow or by kman
Published on 2010-05-21T14:46:34Z Indexed on 2010/05/21 15:20 UTC
Read the original article Hit count: 240

Filed under:

I am new to this, so please bear with me...

I need to very simply modify content based on a template match: topic/body/section/title

This template match works fine. However, I need this to only happen if the topic element has a title element with the value of "Preface".

Can someone please help with the code?

Here is the code:

<topic>
  <title>Preface</title>
  <body>
    <p>This publication was written for...</p>
    <section>
      <title>Publication Information/Version</title>

I need to be able to modify section/title only when the text of topci/title = "Preface".

make sense?

© Stack Overflow or respective owner

Related posts about xslt