Re: [xsl] Tags within tags

Subject: Re: [xsl] Tags within tags
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 18 Dec 2000 17:53:59 -0700 (MST)
Nice, Kerry A. (LNG-SHEP) wrote:
> Here is some of the xml:
> <COUNSEL n="105" lntype="seg">
>   For Phyllis Richardson, Appellant: Bernardo Lopez, Federal Public
> Defender/Southern Dist. of FL, Fort Lauderdale, FL.
> 
>   <nl/>
> 
>   <nl/>For United States of America, Appellee: Sangita Rao, Dept of Justice,
> Washington, DC. Neil Karadbil, U.S. Atttorneys Office, Miami, FL. Marc
> Eagleson, Stephen Schlessinger, Anne R. Schultz, U.S. Attorney&apos;s
> Office, Miami, FL. 
> </COUNSEL>
> 
> <JUDGES n="110" lntype="seg">
>   Before BARKETT, WILSON and MAGILL *, Circuit Judges. 
>   <footnote headerend="no" headerbegin="no">
>     <fn id="fnotestar1" fnridrefs="refstar1" labelicon="yes">
>       <fnbody>
>         <nl/>
>         <nl/>
>         * Honorable Frank J. Magill, U.S. Circuit Judge for the Eighth
> Circuit Court of Appeals, sitting by designation. WILSON, Circuit Judge,
> concurring. 
>       </fnbody>
>     </fn>
>   </footnote> 
> </JUDGES>
> 
> And so far, this xsl has not worked:
> 
> <xsl:template match="COUNSEL">
> \par <xsl:text disable-output-escaping="yes">&lt;I&gt;</xsl:text>
> <xsl:value-of select="."/>
> </xsl:template>
>
> <xsl:template match="JUDGES">
> \par <xsl:text disable-output-escaping="yes">&lt;I&gt;</xsl:text>
> <xsl:value-of select="."/>
> \par\par }  }
> </xsl:template>
> 
> <xsl:template match="nl">
> \par
> </xsl:template>

xsl:value-of doesn't do what you think it does.
Replace both instances with <xsl:apply-templates/>, and add

<xsl:template match="*">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

and you will see something much closer to what you want.

This makes the default for any element be to copy the element, its
attributes, and its children (thus picking up footnote, fn, etc. intact).
This overrides the default template for elements, which is just
<xsl:apply-templates/>. This is overriden by the templates for COUNSEL,
JUDGES and nl elements.

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at            My XML/XSL resources: 
webb.net in Denver, Colorado, USA              http://skew.org/xml/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread