|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Change text on given node at runtime
Hi Jeff ,
You can try a XSL something like below. This will
replace the contents of tag <A> with 'Some new text'
and copy other things to output as it is. But you want
to provide the tag name and the new text, *at run
time*. If you can tell what is your XSLT processor and
*how you would like to supply the 2 parameters at run
time*, i can try modifying the stylesheet accordingly.
i don't know if Jeni's XSL is meeting your
requirement(it looks quite complicated to me for your
problem).
Regards,
Mukul
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="A">
<A>Some new text</A>
</xsl:template>
</xsl:stylesheet>
--- jeff.day@xxxxxx wrote:
> Hi
>
> Can you please give some guidance on this...
>
> I would like to be able, at runtime, to parse an XML
> file and change
>
> <A>Original text</A>
>
> to
>
> <A>Some new text</A>
>
>
> On the next occasion I might want to do this...
>
> <F>Old text</F>
>
> change to
>
> <F>New text</F>
>
> So at runtime I need to pass in two parameters that
> specify the required
> node and the new text for it.
>
> There are two issues: Either change the text in
> every node called <A>
> throughout the document or else only change <A>
> along a particular path. A
> solution to either (or both?) option will do for me.
>
> Of course the rest of the document must remain in
> its entirety, e.g.
> attributes, children etc.
>
> Many thanks for any help given.
>
> Regards
>
> Jeff
>
>
> XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








