Re: [xsl] replace xml element

Subject: Re: [xsl] replace xml element
From: "valerie liston" <valerie_liston@xxxxxxxxxxxxxx>
Date: Wed, 1 May 2002 06:59:47 -0700
Thanks Jeni, I'll give that a try but also I was just wondering is there a
possibility of doing some sort of search and replace in xslt, ie. search
through the whole xml doc and replace any occurrence of the tag <break/>
with <br/>?

00 353 61 419440

----- Original Message -----
From: "Jeni Tennison" <jeni@xxxxxxxxxxxxxxxx>
To: "valerie liston" <valerie_liston@xxxxxxxxxxxxxx>
Cc: <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, May 01, 2002 1:47 AM
Subject: Re: [xsl] replace xml element

> Hi Valerie,
> > 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.
> Rather than just getting the *value* of the content (with
> xsl:value-of), apply templates to it:
>   <xsl:apply-templates select="item/par/content" />
> and then add a template that matches break elements and, when they're
> encountered, inserts a br element to the result instead:
> <xsl:template match="break">
>   <br />
> </xsl:template>
> When you tell the processor to apply templates to the content element,
> it will search through the templates in your stylesheet to find one
> that matches content elements. If it doesn't find one, it'll use the
> built-in template:
> <xsl:template match="*">
>   <xsl:apply-templates />
> </xsl:template>
> This tells the processor to apply templates to all the child nodes of
> the matched (content) element -- the text nodes and the break
> elements. When the processor tries to find a template that matches
> text nodes, again it won't find one in your stylesheet, so it'll use
> the built-in one:
> <xsl:template match="text()">
>   <xsl:value-of select="." />
> </xsl:template>
> so the value of each text node will be added to the result. When the
> processor tries to find a template that matches the break elements, it
> will find the one that you've provided, and add a br element to the
> result for each one.
> Applying templates to content and having templates to match different
> bits of that content (a push approach) is the best way of processing
> mixed content such as that in your example.
> Cheers,
> Jeni
> ---
> Jeni Tennison

begin 666 InterScan_Disclaimer.txt

 XSL-List info and archive:

Current Thread