title: XSL template match based on another element's attribute value
body: <p>I have been successfully finding and replacing an XML tag with XSL, but have found an occurrence where my XSL may not work.</p>
  
  <p>Source XML:</p>
  
  <pre><code>&lt;article&gt;
      &lt;parastyles&gt;
          &lt;parastyle name="Headline Bold" uid="876"/&gt;
          &lt;parastyle name="Head babies-recipe" uid="877"/&gt;
          &lt;parastyle name="Byline Paper" uid="885"/&gt;
          &lt;parastyle name="Byline Name" uid="886"/&gt;
          &lt;parastyle name="Body Copy" uid="904"/&gt;
      &lt;/parastyles&gt;
      &lt;charstyles&gt;
          &lt;charstyle name="[None]" uid="103"/&gt;
      &lt;/charstyles&gt;
      &lt;story name="body"&gt;
          &lt;runs&gt;
              &lt;run p="886" c="103"&gt;By AUTHOR NAME
                  &lt;eol/&gt;
              &lt;/run&gt;
                  &lt;run p="885" c="103"&gt;Local Writer
                  &lt;eol/&gt;
              &lt;/run&gt;
              &lt;run p="904" c="103"&gt;CITY — Borough Police en
                  &lt;eol hyphenated="true"/&gt;
                  countered three men in separate cases
                  &lt;eol/&gt;
                  recently who all claimed they had for
                  &lt;eol hyphenated="true"/&gt;
                  gotten they were carrying drugs or drug
                  &lt;eol/&gt;
                  paraphernalia until an officer started
                  &lt;eol/&gt;
                  asking questions.
              &lt;/run&gt;
              &lt;run p="877" c="103"&gt;
                  Forgot joints
                  &lt;eol/&gt;
              &lt;/run&gt;
              &lt;run p="904" c="103"&gt;
                  In another case, City
                  &lt;eol/&gt;
                  Police were called to a home
                  &lt;eol/&gt;
                  on LaSalle Street March 30
                  &lt;eol/&gt;
                  for a report of a man banging
                  &lt;eol/&gt;
                  on the door.
                  &lt;eol/&gt;
              &lt;/run&gt;
              &lt;run p="877" c="103"&gt;
                  Forgot pipe
                  &lt;eol/&gt;
              &lt;/run&gt;
              &lt;run p="904" c="103"&gt;
                  In a third case, Ptlm. Raf
                  &lt;eol hyphenated="true"/&gt;
                  ferty spotted a young man
                  &lt;eol/&gt;
                  running along West Second
                  &lt;eol/&gt;
                  Street and ducking into an
                  &lt;eol/&gt;
                  area near the Salvation Army
                  &lt;eol/&gt;
                  drop-off on March 28 around
                  &lt;eol/&gt;
                  1:40 a.m.
                  &lt;eol/&gt;
              &lt;/run&gt;
          &lt;/runs&gt;
      &lt;/story&gt;
  &lt;/article&gt;
  </code></pre>
  
  <p>My XSL was as follows:</p>
  
  <pre><code>&lt;xsl:template match="run[@p='877']"&gt;
      &lt;xsl:text&gt;&amp;lt;strong&amp;gt;&lt;/xsl:text&gt;&lt;xsl:value-of select="."/&gt;&lt;xsl:text&gt;&amp;lt;/strong&amp;gt;&lt;/xsl:text&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>This wrapped the selected line with the desired  tag. However, what I really need is to wrap any lines with a  that has a name of "Head babies-recipe" with . Thus far, they have all had a uid of "877" and using run[@p='877'] has worked. However there could be an instance were the uid is NOT "877". So need my 'match' statement to look for a  where p is equal to the the uid of a parastyle where the name is "Head babies-recipe". That's a little more complicated and I've not been able to come up with working XSL for that.</p>
  
  <p>Any help is appreciated!</p>