Results 1 to 1 of 1
  1. #1
    Ginouser is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default Pz Help Simple XSL filter

    hi all,
    i try to write a simple filter using xsl. This is my test xml:

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
        <data name="aaa">
            <foo/>
        </data>
        <data name="xxx">
            <foo/>
        </data>
    </root>
    I desire to produce this:

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
        <data name="aaa">
            <foo/>
        </data>
    </root>
    whitout node with name=xxx, i try this xsl but don't work:

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
                    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:exsl="http://exslt.org/common"
                    extension-element-prefixes="exsl">
        <xsl:output method="xml"/>
    
        <xsl:variable name="prima">
            <xsl:copy-of select="*"/>
        </xsl:variable>
    
        <xsl:variable name="seconda">
            <xsl:apply-templates mode="filtro"/>
        </xsl:variable>
    
        <xsl:template match="/">
            <xsl:copy-of select="$seconda"/>
        </xsl:template>
    
    
        <xsl:template match="data" mode="filtro">
            <xsl:if test="@name='aaa'">
                <xsl:copy-of select="$prima"/>
            </xsl:if>
        </xsl:template>
    </xsl:stylesheet>
    can someone help me plz?

    ty to all
    Last edited by Fubarable; 01-20-2010 at 11:39 PM. Reason: code tags added

Similar Threads

  1. web content filter or internet filter
    By sundarjothi in forum Advanced Java
    Replies: 3
    Last Post: 05-15-2008, 12:36 PM
  2. Object filter
    By revathi17 in forum New To Java
    Replies: 2
    Last Post: 08-08-2007, 08:40 PM
  3. Need a filter
    By revathi17 in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 08:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •