Help needed for XML to xslt conversion

13 views
Skip to first unread message

Rahul

unread,
Aug 13, 2010, 2:36:26 AM8/13/10
to django...@googlegroups.com

Hi
I have seen a lots of example to pick the data from simple xml for example

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
<!-- Edited by XMLSpy® -->
<catalog>
    <cd>
        <title>Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
        <price>10.90</price>
        <year>1985</year>
    </cd>
</catalog>

to convert it into a table following xsl works
<xsl:for-each select="catalog/cd">
      <tr>
        <td><xsl:value-of select="title"/></td>
        <td><xsl:value-of select="artist"/></td>
        <td><xsl:value-of select="country"/></td>
      </tr>
      </xsl:for-each>

But what if input is something complex like

<managedObject class="XXX" fullName="YYY" id="436" topoId="2668" mohId="810" hidden="false" create="true" update="true" delete="true">
    <p name="XXXXOrigin" fullName="Change origin" maxOccurs="1" id="19682" status="approved" category="Operation and Maintenance" releaseId="767">
      <description>
        <para>This defines the origin of the last configuration action affecting the object.</para>
      </description>
      <shortDesc>
        <para>This defines the origin of the last configuration action affecting the object..</para>
      </shortDesc>
      <creation priority="mandatory"></creation>
      <modification type="unmodifiable"></modification>
      <features>
        <feature name="Soft Handover Based on Detected Set Reporting" type="optional"/></features>
      <relatedFeatures>
        <featureItem>
          <featureComponent name="Soft Handover Based on Detected Set Reporting" type="optional"/></featureItem>
      </relatedFeatures>
      <interfaces>
        <interface source="RNC" target="RAC" bidirectional="no"/>
        <interface source="RNC" target="EM" bidirectional="no"/></interfaces>
      <productData name="RNC">
        <property name="Stored" value="RNC RNW database" dataType="String"/>
        <property name="Location in GUI" value="RNC RNW Object Browser/ADJD-dialog" dataType="String"/>
        <property name="Requirement ID" value="RNC_EFS_1266_428" dataType="String"/>
        <property name="SW ENV" value="Q4ENV 1.5-0" dataType="String"/></productData>
      <neType>change_origin_t</neType>
      <simpleType base="integer">
        <enumeration value="0" text="Not defined"/>
        <enumeration value="1" text="Network originated configuration action"/>
        <enumeration value="2" text="NetAct RNW plan originated configuration action"/>
        <enumeration value="3" text="Element Manager originated configuration action"/>
        <enumeration value="4" text="Configuration action by automatic tuning function"/>
        <enumeration value="5" text="Element Manager originated mass config action"/>
        <enumeration value="6" text="NetAct originated direct RNW change"/>
        <default>
          <description>
            <para>Value is set by the system</para>
          </description>
        </default>
      </simpleType>
    </p>
</managedObject>

If I need to pick class="XXX" or name="XXXXOrigin".

Please help

Regards
Rahul

Boguslaw Faja

unread,
Aug 13, 2010, 6:28:10 AM8/13/10
to django...@googlegroups.com
Hi,

are you trying to do that using django or this group had been choosed
at random? :-)

I suggest looking for 'xpath'.

hint: /[@attr="val"]

best regards,

> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

--
Bogusław Faja
tel. (+48) 691544955

Reply all
Reply to author
Forward
0 new messages