xsl-list
[Top] [All Lists]

Re: Re: All relavent nodes not printed out...

2003-10-23 10:41:28
Thanks . That worked! However I am getting all the default text nodes printed
out.  The text in "default" and "units" node is printing out. I have template
match defined (for units and default ) but its still printing "degrees" and
"unspecified"
in the output.  Is it possible to have a single rule that will eliminate the
default behaviour of printing text nodes. ? Thanks!

Here is a part of xml

  <Attribute name="restrictThroughputAfterRmax" label="Restrict Throughput
After Reaching Rmax" ReleaseIntroduced="7">
         <descr/>
         <type t="RestrictAfterRmax"/>
         <default>Unspecified</default>
        <units>degrees</units>
      </Attribute>

XSL Below----

?xml version="1.0"?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output  omit-xml-declaration="yes" indent="no"  encoding="iso-8859-1"
/>
<xsl:template match="objType">
      <xsl:value-of select="@name"/>,<xsl:value-of
select="@ReleaseIntroduced"/>,<xsl:value-of select="@ReleaseChanged"/>
      <xsl:apply-templates/>
  </xsl:template>

<xsl:template match="Attribute">
      <xsl:apply-templates/>
      <xsl:value-of select="@name"/>, <xsl:value-of
select="@ReleaseIntroduced"/>, <xsl:value-of select="@ReleaseChanged"/>
      <xsl:value-of select="."/>
  </xsl:template>

<xsl:template match="units">
      <xsl:apply-templates/>
</xsl:template>

<xsl:template match="default">
      <xsl:apply-templates/>
</xsl:template>

  <xsl:template
    match="*[self::objType or self::Attribute]
                  [not(@ReleaseChanged = 7
                      or
                       @ReleaseIntroduced = 7
                       )
                   ] "/>
</xsl:stylesheet>



Dimitre Novatchev wrote:

In the template matching "objType" you have to allow that the templates
matching and applying process should continue.

As is now, no "Attribute" elements are processed because they happen to be
descendents of "objType".

So you have to add:

   <xsl:apply-templates/>

at the end of the code of the template matching "objType".

=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

"jayanti" <jayanti(_at_)watchmark(_dot_)com> wrote in message
news:3F96FF56(_dot_)2F6F146E(_at_)watchmark(_dot_)com(_dot_)(_dot_)(_dot_)
Hi,
 My xml is listed below.

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

  </typedef>
   <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">
        ...
      </Attribute>
      <Attribute name="btsName" label="BTS Name" ReleaseIntroduced="7">

      ....
     </Attribute>
      <Attribute name="constantPilot" label="Constant Pilot Mode"
ReleaseIntroduced="1">
......
      </Attribute>
      <Attribute name="idleModeGain" label="Idle Mode Gain"
ReleaseIntroduced="1">
         <descr/>
      </Attribute>
   </objType>
</DB1xEV-DO>

-- xsl is below---

<?xml version="1.0"?>
<xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output  omit-xml-declaration="yes" indent="no"
encoding="iso-8859-1"   />
<xsl:template match="objType">
      <xsl:value-of select="@name"/>,<xsl:value-of
select="@ReleaseIntroduced"/>,<xsl:value-of select="@ReleaseChanged"/>
  </xsl:template>

<xsl:template match="Attribute">
      <xsl:value-of select="@name"/>, <xsl:value-of
select="@ReleaseIntroduced"/>, <xsl:value-of select="@ReleaseChanged"/

      <xsl:value-of select="."/>
  </xsl:template>

  <xsl:template
    match="*[self::objType or self::Attribute]
                  [not(@ReleaseChanged = 7
                      or
                       @ReleaseIntroduced = 7
                       )
                   ] "/>
</xsl:stylesheet>


My problem is that the above xsl produces only the objType attributes in

the output not the attributes. Why is that ? and how can I get an output

that looks like the following:
objType = Cell
AttributeName = CellSiteID
AttributeName =  BtsName
.etc...

thanks in advance
j


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



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


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