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

copy-of problem in child node, unable to get parent in

Subject: copy-of problem in child node, unable to get parent in output
From: jayanti <jayanti@xxxxxxxxxxxxx>
Date: Tue, 21 Oct 2003 10:25:04 -0700
xsl copy of child
My XML is below.

<?xml version = '1.0' encoding = 'utf-8'?>
  <DB1xEV-DO>
  <typedef .....
.......

  </typedef>
 <ECPGeneric>
...
</ECPGeneric>

   <objType name="Cell" label="BTS" ReleaseIntroduced="1"
ReleaseChanged="7">
      <Description>This is the description</Description>
      <Attribute name="CellSiteId" label="BTS ID" ReleaseIntroduced="1"
ReleaseChanged="7">
         <descr/>
         <type t="int">
            <range min="1" max="600" step="1"/>
         </type>
      </Attribute>
      <Attribute name="btsName" label="BTS Name" ReleaseIntroduced="7">
         <descr/>
         <type t="string">
            <size>
               <range min="1" max="11" step="1"/>
            </size>
         </type>
         <NullValue Value=" "/>
      </Attribute>
      <Attribute name="constantPilot" label="Constant Pilot Mode"
ReleaseIntroduced="1">
         <descr/>
         <type t="PilotMode"/>
         <default>Normal</default>
      </Attribute>
      <Attribute name="idleModeGain" label="Idle Mode Gain"
ReleaseIntroduced="1">
         <descr/>
      </Attribute>
   </objType>
</DB1xEV-DO>


------
My xsl is:
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"  encoding="iso-8859-1"   />
 <xsl:template match="DB1xEV-DO">
   <xsl:for-each select="typedef|ECPGeneric|ChangeTag">
   <xsl:copy-of select="." />
   </xsl:for-each>


   <xsl:for-each select="objType">
         <xsl:when test="@ReleaseIntroduced='7'">
         <xsl:copy-of select="." />
       </xsl:when>

       <xsl:when test="@ReleaseChanged='7'">
         <xsl:for-each select="Attribute">
            <xsl:choose>
                      <xsl:when test="@ReleaseChanged='7'">
                      <xsl:copy-of select="." />
                      </xsl:when>
                      <xsl:when test="@ReleaseIntroduced='7'">
                      <xsl:copy-of select="." />
                      </xsl:when>
            </xsl:choose>
         </xsl:for-each>
     </xsl:choose>
   </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

The purpose is to output only those ObjType and Attrribute elements
where the ReleaseChanged tag = 7 or ReleaseIntroduced=7
So here are my questions :

1) When the above xsl is applied using Xalan, the output looks like
this: I do not get the objType element to print out. (I want to get the
objType element)  However, I get only the
Attribute elements.

<Attribute name="CellSiteId" label="BTS ID" ReleaseIntroduced="1"
ReleaseChanged="7">
         <descr/>
         <type t="int">
            <range min="1" max="600" step="1"/>
         </type>
      </Attribute>
<Attribute name="btsName" label="BTS Name" ReleaseIntroduced="7">
         <descr/>
         <type t="string">
            <size>
               <range min="1" max="11" step="1"/>
            </size>
         </type>
         <NullValue Value=" "/>
      </Attribute>

2)   Another problem is that I do not get the "descr" element to print
out in the output.  I want all  elements (other than Attribute) to be
just copied from the source xml. For attribute, I want to print it out
only if ReleaseChanged =7 or ReleaseIntroduced=7.

thanks
j





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.