xsl-list
[Top] [All Lists]

RE: [xsl] Writing xslt from DSML

2010-04-20 09:37:06

Looks like two template rules:

<xsl:template match="batchResponse">
  <xsl:copy>
    <xsl:apply-templates select=".//attr">
  </xsl:copy>
</xsl:template>

<xsl:template match="attr">
  <xsl:element name="{(_at_)name}">
    <xsl:value-of select="value"/>
  </xsl:element>
</xsl:template>

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 
 

-----Original Message-----
From: vinu shankar [mailto:vinuav_13(_at_)yahoo(_dot_)co(_dot_)in] 
Sent: 20 April 2010 14:20
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Writing xslt from DSML

Hi,

I am using XSLT 2.0.
I have to form write the XSLT for the DSML content extracted 
from a LDAP server.
I am trying to generate an XML fragment from multivalued LDAP 
attributes. data(in DSML form) looks like

<batchResponse xmlns:xsd="http://www.w3c.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance";>
   <searchResponse>
      <searchResultEntry 
dn="uid=282002558871883,ou=People,o=sct.com,o=cp">
         <attr name="uid">
            <value>282002558871883</value>
         </attr>
         <attr name="pdsloginid">
            <value>fac60006</value>
         </attr>
         <attr name="givenname">
            <value>Brutus</value>
         </attr>
         <attr name="pdsemaildefaultaddress">
            <value>fac60006(_at_)sct(_dot_)com</value>
         </attr>
         <attr name="pdscpsurveyed">
            <value>true</value>
         </attr>
</searchResponse>
</batchResponse >

I need the XML file from the above DSML file.
The XML file which I need is
<batchResponse xmlns:xsd="http://www.w3c.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance";>
    <uid>
   
     282002558871883
    </uid>
    <pdsloginid>
        fac60006
    </pdsloginid>
    <givenname>
        Brutus
    </givenname>
    <pdsemaildefaultaddress>
        fac60006(_at_)sct(_dot_)com
    </pdsemaildefaultaddress>
    <pdscpsurveyed>
        true
    </pdscpsurveyed>
</batchResponse >
So how can I achieve this using XSLT.
I am a newbee to XSLT.Please help

Thank you,
Evergreen








--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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