homepage Welcome to WebmasterWorld Guest from 54.234.0.85
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
Removing a particular attribute
Want to remove a particular attribute using xslt
Abhinand




msg:3906205
 7:11 am on May 4, 2009 (gmt 0)
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.

 

httpwebwitch




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved