xml - XSLT Remove Element Based On Attribute -


i struggling basic xslt. remove element xml depending on whether has attribute.

the xml looks so:

<root>     <request url="www.google.com">         <id name="google"/>     </request>     <request url="www.yahoo.com">         <id name="yahoo"/>     </request> </root> 

i remove request element if url "www.google.com" , remove element , , end following:

<root>     <request url="www.yahoo.com">         <id name="yahoo"/>     </request> </root> 

i have following far, isn't working:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">   <!--identity template copies forward default-->        <xsl:template match="node()|@*">     <xsl:copy>       <xsl:apply-templates select="node()|@*"/>     </xsl:copy>   </xsl:template>    <!--empty template suppresses attribute-->   <xsl:template match="request[@url='www.google.com']"/> </xsl:stylesheet> 

your xml source has attribute name "url" trying match "url".


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -