Subject: Re: [xsl] add new elements using xsl From: "Felix Geller" <fgeller@xxxxxxxxx> Date: Tue, 15 Apr 2008 21:50:52 +0200 |
Uh, well the simplest would be what I said in my previous email -- file B is the content of the template element: <xsl:template match="sch"> <sch> <si> <default>My text1</default> <default2>My text2</default2> </si> </sch> </xsl:template> Cheers, felix On Tue, Apr 15, 2008 at 9:40 PM, Nishi Bhonsle <nishi.bhonsle@xxxxxxxxxx> wrote: > Hi: > > > Felix Geller wrote: > > > > The @name selects an attribute in the location step with respect to > > the context node. But there are no attribute in your version of file > > A. More specifically You might need file A to look more like the > > following > > > > <sch> > > <si default="My text1" default2="My text2"> > > </si> > > </sch> > > > > Not sure if this is what you intended to do -- another option would be > > to adjust your template. > > > Can you tell me how to adjust the template? My original FileA doesnot > contain anything else than whats mentioned earlier hence no any computation > is possible from FileA to FileB. > > > > > > But then again that would simply mean that > > file B would be the content of the template element (As there is no > > content in file A from which the content of the default elements in > > file B could be computed as far as I can tell). If you'd elaborate a > > little more on the context of the problem we might be able to help you > > on the XSLT side. > > > > Cheers, > > Felix > > > > On Tue, Apr 15, 2008 at 7:54 PM, Nishi Bhonsle <nishi.bhonsle@xxxxxxxxxx> > wrote: > > > > > > > Hi : > > > > > > I have File A: > > > <?xml version="1.0"?> > > > <sch> > > > <si> > > > </si> > > > </sch> > > > > > > I need to convert it to File B: > > > <?xml version="1.0"?> > > > <sch> > > > <si> > > > <default>My text1</default> > > > <default2>My text2</default2> > > > </si> > > > </sch> > > > > > > Will the following xsl help? > > > <xsl:template match="sch"> > > > <xsl:copy-of select="si/@default"/> > > > <xsl:copy-of select="si/@default2"/> > > > <xsl:apply-templates /> > > > </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] add new elements using xs, Nishi Bhonsle | Thread | Re: [xsl] add new elements using xs, Manfred Staudinger |
Re: [xsl] add new elements using xs, Nishi Bhonsle | Date | Re: [xsl] add new elements using xs, Manfred Staudinger |
Month |