Xml to html display

Hi all,

I need to parse following xml docs in a table where i can display it in
html like (table type format)

kp:inputBindings

xsl:choose
<xsl:when test="$map/xyz=‘true’">
ns1:ABC
<xsl:value-of name="$ap/abc">
</ns1:ABC>
ns1:PQR
<xsl:value-of name="$bp/fff">
</ns1:PQR>
</xsl:when>
</xsl:choose>


</kp:inputBindings>

Output like this in HTML -

col1 col2 col3

  •           choose                                   -
              |
    
  •           -when test="$map/xyz"                    -
                                                     data
                                                     |
    

$ab/abc ---------------------------------------------->|-ABC
$bp/fff ---------------------------------------------->|-PQR

I don’t expect there is a existing library/class that will do that but
any suggestions what will be the best approach to do this …

If there is some existing lib that does close to his , that will
obviously be great.

Thanks in advance

On Tue, Jan 10, 2012 at 12:55 AM, dabba dabba
[email protected]wrote:

           <xsl:value-of name="$ap/abc">

Output like this in HTML -

I don’t expect there is a existing library/class that will do that but
any suggestions what will be the best approach to do this …

If there is some existing lib that does close to his , that will
obviously be great.

I suggest you look into Nokogiri.org

Something I just tried:
1.9.3p0 :001 > require ‘nokogiri’
=> true
1.9.3p0 :037 > s = <<EXAMPLE
1.9.3p0 :038"> kp:inputBindings
1.9.3p0 :039">
1.9.3p0 :040"> xsl:choose
1.9.3p0 :041"> <xsl:when test=“$map/xyz=‘true’”>
1.9.3p0 :042"> ns1:ABC
1.9.3p0 :043"> <xsl:value-of name=“$ap/abc”>
1.9.3p0 :044"> </ns1:ABC>
1.9.3p0 :045"> ns1:PQR
1.9.3p0 :046"> <xsl:value-of name=“$bp/fff”>
1.9.3p0 :047"> </ns1:PQR>
1.9.3p0 :048"> </xsl:when>
1.9.3p0 :049"> </xsl:choose>
1.9.3p0 :050">
1.9.3p0 :051"> …
1.9.3p0 :052"> </kp:inputBindings>
1.9.3p0 :053"> EXAMPLE

1.9.3p0 :055 > n = Nokogiri.XML(s)

1.9.3p0 :057 > n.children

HTH,

Peter