xsl-list
[Top] [All Lists]

RE: [xsl] how to do this

2008-11-05 03:48:12
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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>