Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2006

Tip: Looking for answers? Try searching our database.

Simple XSLT Question?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ganesh Muthuvelu - 19 Jul 2006 00:33 GMT
Hello all,

I have a XML as below:
******************
<BLOCK>
 <ROW1>
   <A>1</A>
   <B>2</B>
 </ROW1>
 <ROW2>
   <A>9</A>
   <B>3</B>
   <C>4</C>
 </ROW2>
 <ROW3>
 <ROW31>
   <A>5</A>
   <D>6</D>
   <E>7</E>
 </ROW31>
 </ROW3>
</BLOCK>
******************

with which I want to apply 2 rules:
1) Move "ROW3" up and bring the element "ROW2" down.
2) Change the element name "ROW2" to "order"

This is my xsl:
***************
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node() | @*">
 <xsl:copy>
  <xsl:apply-templates select="node() | @* "/>
 </xsl:copy>
</xsl:template>

<xsl:template match="BLOCK">
<BLOCK>
   <xsl:copy-of select="ROW1"/>
   <xsl:copy-of select="ROW3"/>
   <xsl:copy-of select="ROW2"/>
</BLOCK>
</xsl:template>

<xsl:template match="ROW2">
 <xsl:element name="order">
  <xsl:apply-templates/>
 </xsl:element>
</xsl:template>

</xsl:stylesheet>
***************

However, the element "ROW2" does not get changed to "order" but the first
rule works..

Any help is appreciated..

Thanks,
Ganesh
Dimitre Novatchev - 19 Jul 2006 04:48 GMT
Just change:

>    <xsl:copy-of select="ROW2"/>

to:

  <xsl:apply-templates select="ROW2"/>

Cheers,
Dimitre Novatchev

> Hello all,
>
[quoted text clipped - 59 lines]
> Thanks,
> Ganesh

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.