Welcome to WebmasterWorld Guest from 107.22.87.205

Forum Moderators: httpwebwitch

Message Too Old, No Replies

Removing a particular attribute

Want to remove a particular attribute using xslt

     
7:11 am on May 4, 2009 (gmt 0)

5+ Year Member


I have the following xml file from which i want to remove all attributes named TEMP_INST_NAME

<SHW_SERVER INST_NAME="DELL @ 10.99.125.140" IconID="27" DETAIL1="PowerEdge 1850" DETAIL2="A02" DETAIL3="CBH9G1S" DETAIL4="5.6.0" PROTOCOL="Snmp">
- <SHW_MASSFDR INST_NAME="Mass Storage">
- <SHW_LOGIDISKFDR INST_NAME="Array Logical Disk">
<SHW_LOGIDISKELM TEMP_INST_NAME="0" INST_NAME="1" DETAIL1="Virtual Disk 0" DETAIL2="139760" DETAIL3="65536" DETAIL4="2" />
</SHW_LOGIDISKFDR>
- <SHW_PHYDISKFDR INST_NAME="Array Physical Disk">
<SHW_PHYDISKELM TEMP_INST_NAME="0" INST_NAME="1" DETAIL1="Array Disk 0:0" DETAIL2="MAXTOR" DETAIL3="69880" DETAIL4="D20XYK2K" DETAIL5="1" />
<SHW_PHYDISKELM TEMP_INST_NAME="1" INST_NAME="2" DETAIL1="Array Disk 0:1" DETAIL2="MAXTOR" DETAIL3="69880" DETAIL4="D20Y8WLK" DETAIL5="1" />
</SHW_PHYDISKFDR>
</SHW_MASSFDR>
</SHW_SERVER>

How can i do this using style sheet.

12:56 am on May 21, 2009 (gmt 0)

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi Abhinand,
welcome to WebmasterWorld!

I think it'd be easier to do this with a Regular expression.

Using XSLT you'll likely have to iterate through each node and make a copy with the TEMP_INST_NAME attribute omitted.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month