title: XSLT transform replacing a tag that appears periodically through document
body: <p>I have an xml document that I am transforming with xslt into an xsl-fo document. I have this tricky problem I've been trying to track down a solution to for a long time...</p>
  
  <p>In my source xml I have a few  tags interspersed throughout. I want to format these as underline in the resulting document, however I have not been able to do so.</p>
  
  <p>I'm trying using code like this:</p>
  
  <pre><code>&lt;xsl:template match="//em"&gt;
    &lt;fo:inline text-decoration="underline"&gt;
      &lt;xsl:apply-templates select="*|text()"/&gt;
    &lt;/fo:inline&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>The full XSLT looks like this:
         </p>
  
  <pre><code>&lt;xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0"&gt;
  
  
  
    &lt;!-- match em tags --&gt;
    &lt;xsl:template match="//em"&gt;
      &lt;fo:inline text-decoration="underline"&gt;
        &lt;xsl:apply-templates select="*|text()"/&gt;
      &lt;/fo:inline&gt;
    &lt;/xsl:template&gt;
    &lt;xsl:template match="//u"&gt;
      &lt;fo:inline text-decoration="underline"&gt;
        &lt;xsl:apply-templates select="*|text()"/&gt;
      &lt;/fo:inline&gt;
    &lt;/xsl:template&gt;
  
    &lt;!-- match b tags --&gt;
    &lt;xsl:template match="//b"&gt;
      &lt;fo:inline font-weight="bold"&gt;
        &lt;xsl:apply-templates select="*|text()"/&gt;
      &lt;/fo:inline&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="//br"&gt;
      &lt;fo:block&gt;&lt;xsl:text&gt;&amp;#xA;&lt;/xsl:text&gt;&lt;/fo:block&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="briefs"&gt;
      &lt;fo:root&gt;
        &lt;fo:layout-master-set&gt;
          &lt;fo:simple-page-master master-name="Evidence" page-width="8.5in" page-height="11in" margin="1in"&gt;
            &lt;fo:region-body margin-bottom=".5in" margin-top=".5in" region-name="xsl-region-body" /&gt;
            &lt;fo:region-before extent="1em" region-name="xsl-region-before" /&gt;
            &lt;fo:region-after extent="1em" region-name="xsl-region-after" /&gt;
          &lt;/fo:simple-page-master&gt;
        &lt;/fo:layout-master-set&gt;
        &lt;xsl:for-each select="brief"&gt;
          &lt;fo:page-sequence master-reference="Evidence"&gt;
          &lt;fo:static-content flow-name="xsl-region-before" font-family="Times"&gt;
             &lt;fo:block font-size="10pt" text-align="center" color="#666666"&gt;
              &lt;fo:inline font-style="italic"&gt;&lt;xsl:value-of select="title"/&gt;&lt;/fo:inline&gt; by &lt;xsl:value-of select="author"/&gt;
             &lt;/fo:block&gt;
          &lt;/fo:static-content&gt;
  
          &lt;fo:static-content flow-name="xsl-region-after" font-family="Times" font-size="10pt"&gt;
            &lt;fo:table&gt;
              &lt;fo:table-column /&gt;
              &lt;fo:table-column column-width="1in" /&gt;
              &lt;fo:table-body&gt;
                &lt;fo:table-row&gt;
                  &lt;fo:table-cell&gt;
                    &lt;fo:block text-align="left" color="#666"&gt;&lt;xsl:value-of select="copyright"/&gt;&lt;/fo:block&gt;
                  &lt;/fo:table-cell&gt;
                  &lt;fo:table-cell&gt;
                    &lt;fo:block text-align="right" font-weight="bold"&gt;
                      Page &lt;fo:page-number/&gt;
                    &lt;/fo:block&gt;
                  &lt;/fo:table-cell&gt;
                &lt;/fo:table-row&gt;
              &lt;/fo:table-body&gt;
            &lt;/fo:table&gt;
          &lt;/fo:static-content&gt;
  
          &lt;fo:flow flow-name="xsl-region-body" font-family="Times"&gt;
            &lt;fo:block font-size="14pt" text-align="center" text-transform="uppercase" border-before-width="2pt" border-before-color="black" border-before-style="double" border-after-width="1pt" border-after-color="black" border-after-style="solid" background-color="#ccc"&gt;
              &lt;xsl:value-of select="title"/&gt;
             &lt;/fo:block&gt;
  
            &lt;xsl:for-each select="heading"&gt;
              &lt;xsl:choose&gt;
                &lt;xsl:when test="@level = 2"&gt;
                  &lt;fo:block font-size="11pt" font-weight="bold" keep-with-next="always" text-transform="uppercase" padding-before="1em"&gt;
                    &lt;xsl:value-of select="title"/&gt;&lt;/fo:block&gt;
                &lt;/xsl:when&gt;
                &lt;xsl:when test="@level = 3"&gt;
                  &lt;fo:block font-size="10pt" font-weight="normal" keep-with-next="always" text-transform="uppercase" padding-before="1em"&gt;
                    &lt;xsl:value-of select="title"/&gt;&lt;/fo:block&gt;
                &lt;/xsl:when&gt;
                &lt;xsl:otherwise&gt;
                  &lt;fo:block font-size="12pt" font-weight="bold" keep-with-next="always" text-transform="uppercase" padding-before="1em"&gt;
                    &lt;xsl:value-of select="title"/&gt;&lt;/fo:block&gt;
                &lt;/xsl:otherwise&gt;
              &lt;/xsl:choose&gt;
  
              &lt;xsl:for-each select="content/item"&gt;
                &lt;xsl:choose&gt;
                  &lt;xsl:when test="@type = 'card'"&gt;
                    &lt;!--Print the taglines--&gt;
                    &lt;fo:block font-size="10pt" font-weight="bold" padding-before="1em" keep-with-next="always"&gt;
                      &lt;!--&lt;xsl:number value="position()" format="1" /&gt;. --&gt;
                      &lt;xsl:value-of select="tagline"/&gt;
                    &lt;/fo:block&gt;
  
                    &lt;!--Print the citation--&gt;
                    &lt;fo:block font-size="10pt" font-style="italic" keep-with-next="always" keep-together.within-page="always" margin-left=".25in" padding-before=".5em"&gt;
                      &lt;!--&lt;xsl:number value="position()" format="1" /&gt;. --&gt;
                      &lt;xsl:value-of select="citation" disable-output-escaping="yes" /&gt;
                    &lt;/fo:block&gt;
  
                    &lt;!--Print the body--&gt;
                    &lt;fo:block font-size="10pt" keep-together.within-page="always" margin-left=".25in" padding-before=".5em"&gt;
                      &lt;!--&lt;xsl:number value="position()" format="1" /&gt;. --&gt;
                      &lt;xsl:value-of select="quote" disable-output-escaping="yes" /&gt;
                    &lt;/fo:block&gt;
  
                  &lt;/xsl:when&gt;
                  &lt;xsl:otherwise&gt;
                    &lt;fo:block font-size="10pt" padding-before=".5em"&gt;&lt;xsl:value-of select="."/&gt;&lt;/fo:block&gt;
                  &lt;/xsl:otherwise&gt;
                &lt;/xsl:choose&gt;
              &lt;/xsl:for-each&gt;
  
            &lt;/xsl:for-each&gt;
  
  
          &lt;/fo:flow&gt;
  
        &lt;/fo:page-sequence&gt;
        &lt;/xsl:for-each&gt;
      &lt;/fo:root&gt;
    &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Does anyone have any ideas?
  Thanks so much!!!!!</p>