xsl-list
[Top] [All Lists]

RE: xsl for parsing strange xml

2002-09-23 09:43:16
Hi, I am trying to genrate html not only for java files, but also C# files. So, 
I need to devise a way to modify my stylesheet.

This is what I mean by messing up of html.

<div id="T:Car" class="type">Car</div>
<div id="T:Vehicle" class="type">
<div id="M:Vehicle.getIdentification" class="method">...</div>
<div id="M:Car.getIdentification" class="method">...</div>
<div id="M:Car.getName" class="method">...</div>
</div>
</div>

Vehicle div includes even the Car details.

I want the html to be like :

<div id="T:Car" class="type">Car</div>
<div id="M:Car.getIdentification" class="method">...</div>
<div id="M:Car.getName" class="method">...</div>
</div>
<div id="T:Vehicle" class="type">
<div id="M:Vehicle.getIdentification" class="method">...</div>
</div>


My XSL file looks like :

<xsl:template match="member" mode="type">
<div style="visibility:'visible';display:'block'" class="type">
  <xsl:apply-templates select="summary" />
  <xsl:apply-templates select="key('methods', @name)" mode="method" />
</div>
</xsl:template>

<xsl:key name="methods" match="member[starts-with(@name,'M')]" 
use="preceding-sibling::member[starts-with(@name,'T')][1]/@name" />

<xsl:template match="member" mode="method">
<xsl:if test="preceding-sibling::member[starts-with(@name,'T')][1]">
<div style="visibility:'visible';display:'block'" class="method">
  <xsl:apply-templates select="summary" />
</div>
</xsl:template>

Please help.

Thanks,
-Aparna
---

On Mon, 23 Sep 2002 16:49:47  
 James Fuller wrote:
I need help in parsing an xml file generated for java classes and
interfaces. Suppose I have a class like Car, and say Car
implements Vehicle interface.


have u thought about using RDF to represent this....and I believe you could
probably find similar stuff already done
http://www.google.com/search?sourceid=navclient&q=java+code+generation+with+
xslt


interface Vehicle{
     getIdentification();
}

class Car implements Vehicle
{
     getName();
     getIdenitifcation();
}

XML is of the form :

<member name="T:Car">
     <summary>
             It's a car class.
      </summary>
</member>
<member name="T:Vehicle">
      <summary>
             It's a vehicle interface.
     </summary>
</member>
<member name="M:Vehicle.getIdentification">
      <summary>
            Identification of the vehicle.
      </summary>
</member>
<member name="M:Car.getName">
      <summary>
            Name of the Car.
      </summary>
</member>
<member name="M:Car.getIdentification">
      <summary>
            Name of the Car.
      </summary>
</member>

Note that in xml M: stands for method, and T: stands for Type.

well in xml these are namespaces.....hehe

Do you see that interface Vehicle information comes in between
Car? Because of this html is messed up.

have no idea what you're on about ( reaching for my mind reading version of
email reader ).......its messed up because u think its messed up ?

you're best bet is to show us

a) what u have ( i believe you've done this )

b) show us what u want ( in html whatever )

add any interesting and witty comments.....

gl, jim fuller


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




_____________________________________________________________
Play the Elvis® Scratch & Win for your chance to instantly win $10,000 Cash
- a 2003 Harley Davidson® Sportster® - 1 of 25,000 CD's - and more!
http://r.lycos.com/r/sagel_mail_scratch_tl/http://win.ipromotions.com/lycos_020801/index.asp?tc=7087
 

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



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