|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with nested Stuff
Thank you!
This does what i want.
So simple, but i didn't got it!
;)
M. Jolie
> --- Urspr|ngliche Nachricht ---
> Von: JBryant@xxxxxxxxx
> An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Betreff: Re: Problem with nested Stuff
> Datum: Mon, 14 Nov 2005 14:19:11 -0600
>
> If all you want is to replace the contents of any element that has a myid
> attribute with the value of the myid attribute, you can do it with two
> templates: an identity transform and another template that matches any
> element with a myid attribute. Here's a stylesheet that does it:
>
> <?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" omit-xml-declaration="no"
> indent="yes"/>
>
> <xsl:template match="@*|node()">
> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy>
> </xsl:template>
>
> <xsl:template match="*[@myid]">
> <xsl:copy>{<xsl:value-of select="@myid"/>}</xsl:copy>
> </xsl:template>
>
> </xsl:stylesheet>
>
> I tested it with Xalan Java 2.4.1 (after I added a root element to your
> XML snippet).
>
> The difference between my approach and Jon Gorman's approach is that I use
> templates and he uses xsl:choose, but the approaches are otherwise very
> similar. (Jon's response came in as I was writing my response, by the
> way.)
>
> I suspect you may want something more than what Jon and I have shown,
> though, as it seems odd to me that you would want to throw away the
> content of elements that have myid attributes.
>
> Jay Bryant
> Bryant Communication Services
> (presently consulting at Synergistic Solution Technologies)
>
>
>
> "Miladen Jolie" <my.office@xxxxxx>
> 11/14/2005 01:20 PM
> Please respond to
> xsl-list@xxxxxxxxxxxxxxxxxxxxxx
>
>
> To
> xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> cc
>
> Subject
> Problem with nested Stuff
>
>
>
>
>
>
> Hi,
>
> i want to get from:
>
> <div myid="test">blah</div>
> <table>
> <tr>
> <td>test</td>
> <td myid="test2">blah2</td>
> </tr>
> </table>
>
> this:
>
> <div>{test}</div>
> <table>
> <tr>
> <td>test</td>
> <td>{test2}</td>
> </tr>
> </table>
>
> How can achieve this?
>
> Thx in advance.
>
> Miller
>
> --
> Highspeed-Freiheit. Bei GMX superg|nstig, z.B. GMX DSL_Cityflat,
> DSL-Flatrate f|r nur 4,99 Euro/Monat* http://www.gmx.net/de/go/dsl
>
--
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen f|r GMX Partner: http://www.gmx.net/de/go/partner
|
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








