[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: how to do this

Subject: RE: how to do this
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 5 Nov 2008 08:47:46 -0000
RE:  how to do this
> I want to change xml given below
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
> <ZooConfiguration 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="..\..\..\schema\Zoo.xsd">

Those backslashes should be forward slashes - URIs never use backslash as a
separator!

>   <Configuration id="default">
>     <AnnouncementOrder>
>       <Announcement>Donkey</Announcement>
>       <Announcement>Lion</Announcement>
>       <Announcement>Snake</Announcement>
>       <Announcement>Zebra</Announcement>
>     </AnnouncementOrder>
>   </Configuration>
> </ZooConfiguration>
> 
> 
> Condition is that if any one of (Elephant,Monkey) is there , 
> donot change any thing in xml . If none of (Elephant,monkey) 
> present then add both (Elephant,monkey) in sequence .

Something like

<xsl:template match="AnnoucementOrder[Announcement='Elephant' or
Announcement='Monkey']"
              priority="20">
  <xsl:copy-of select="."/>
</xsl:template>

<xsl:template match="AnnoucementOrder"
              priority="10">
<xsl:copy>
  <xsl:copy-of select="child::node()"/>
  <Announcement>Elephant</Announcement>
  <Announcement>Monkey</Announcement>
</xsl:copy>
</xsl:template>

Michael Kay
http://www.saxonica.com/
  
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
> <ZooConfiguration 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="..\..\..\schema\Zoo.xsd">
>   <Configuration id="default">
>     <AnnouncementOrder>
>       <Announcement>Donkey</Announcement>
>       <Announcement>Lion</Announcement>
>       <Announcement>Snake</Announcement>
>       <Announcement>Zebra</Announcement>
>       <Announcement>Elephant</Announcement>
>       <Announcement>Monkey</Announcement>
>     </AnnouncementOrder>
>   </Configuration>
> </ZooConfiguration>
> 
> thanks
> Amit singh

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.