This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: replace xml element


Write a template rule for each element saying how you want that element to
be processed:

<xsl:template match="content">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="break>
  <br/>
</xsl:template>

You might want to add a default rule that copies elements unchanged:

<xsl:template match="*">
  <xsl:copy>
  <xsl:copy-of select="@*"/>
  <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

or that deletes elements together with their content:

<xsl:template match="*"/>

or that processes the contents of the element but drops the start and end
tag:

<xsl:template match="*">
  <xsl:apply-templates/>
</xsl:template>

Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com

> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of valerie
> liston
> Sent: 01 May 2002 09:27
> To: XSL-List@lists.mulberrytech.com
> Subject: [xsl] replace xml element
>
>
> I have a question about replacing xml elements. Here is the problem;
> I want to output the content of the element <content> and replace the
> element <break/> with the html tag <br/>. I know this is
> probably a very
> basic question but I appreciate your help.
> <item name="netinterfacedes" translation="Network Interface
> Description">
>
> <par type="text">
>
> <content>Intel Pro/100 VE Network connection<break/>10 Base-T and 100
> Base-TX physical layer capabilities<break/>Remote wake on LAN
> supported</content>
>
> </par>
>
> </item>
>
> <xsl:value-of select="item/par/content"/>
>
> Thanks
>
>
>
>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]