xml - removing a parent node dependig upon child node using xslt -


i looking forwar template removes anode xml depending upon value of chid node,basically having xml like:

<eventinfo>     <assignmentevent>         <createdatetime>2015-06-02t00:00:00+02:00</createdatetime>     </assignmentevent>     <estimateevent>         <createdatetime>2015-06-02t07:38:28.0000000z</createdatetime>         <commitdatetime>2015-06-04t14:29:38.0000000z</commitdatetime>         <uploaddatetime>2015-06-04t14:29:39.7651796z</uploaddatetime>     </estimateevent>     <otherevent>         <othereventtype>calculateddatetime</othereventtype>         <othereventdatetime>2015-06-04t14:29:12.0000000z</othereventdatetime>     </otherevent>     <otherevent>         <othereventtype>ratedate</othereventtype>         <othereventdatetime>2015-06-01t00:00:00.0000000z</othereventdatetime>     </otherevent>     <otherevent>         <othereventtype>originalcommitdatetime</othereventtype>         <othereventdatetime>2015-06-02t07:42:16.000z</othereventdatetime>     </otherevent> </eventinfo> 

i want xslt template removes other event node along child nodes in other event type value originalcommitdatetime.

resultant xml like

<eventinfo>     <assignmentevent>         <createdatetime>2015-06-02t00:00:00+02:00</createdatetime>     </assignmentevent>     <estimateevent>         <createdatetime>2015-06-02t07:38:28.0000000z</createdatetime>         <commitdatetime>2015-06-04t14:29:38.0000000z</commitdatetime>         <uploaddatetime>2015-06-04t14:29:39.7651796z</uploaddatetime>     </estimateevent>     <otherevent>         <othereventtype>calculateddatetime</othereventtype>         <othereventdatetime>2015-06-04t14:29:12.0000000z</othereventdatetime>     </otherevent>     <otherevent>         <othereventtype>ratedate</othereventtype>         <othereventdatetime>2015-06-01t00:00:00.0000000z</othereventdatetime>     </otherevent> </eventinfo> 

i new xslt highly appreciated.

thanks in advance.

i want xslt template removes other event node along child nodes in other event type value originalcommitdatetime.

the standard method exclude specific nodes start identity transform template copy nodes rule, add empty template matching nodes want exclude exception:

xslt 1.0

<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/> <xsl:strip-space elements="*"/>  <!-- identity transform --> <xsl:template match="@*|node()">     <xsl:copy>         <xsl:apply-templates select="@*|node()"/>     </xsl:copy> </xsl:template>  <xsl:template match="otherevent[othereventtype='originalcommitdatetime']"/>  </xsl:stylesheet> 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -