Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > simple question

Reply
Thread Tools

simple question

 
 
Mike King
Guest
Posts: n/a
 
      10-07-2003
I believe this is a simple question. I need a XSLT file that removes
elements from a source file. I guess the tricky part is I need to use a
variable to indicate which element to preserve. In the example below, I want
to preserve the "/root/a[1]" element where "1" would be a variable. Can
anyone help me? I'm having the hardest time figuring out template rules.

#### Input ####
<?xml version="1.0" ?>
<root>
<a id="1">
<b id="1"/>
</a>
<a id="2">
<b id="2"/>
</a>
<a id="3">
<b id="3"/>
</a>
</root>

#### Output ####
<?xml version="1.0" ?>
<root>
<a id="1">
<b id="1"/>
</a>
</root>


 
Reply With Quote
 
 
 
 
Martin Boehm
Guest
Posts: n/a
 
      10-07-2003
"Mike King" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)

"/root/a[@id = '1']"

Or, with a variable:

<xsl:variable name="id" select="1" />
<xsl:apply-templates select="/root/a[@id = $id]"/>

Martin


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plz, a simple answer to a simple question about IP addresses MeekiMoo Computer Support 0 07-28-2009 08:10 AM
Simple region code question... simple answer?? joseph.greer@gmail.com DVD Video 7 01-26-2007 09:07 PM
Simple Question - Simple Answer? Daniel Frey XML 4 01-12-2005 04:25 PM
Re: Simple Simple question!!! Kevin Spencer ASP .Net 0 06-25-2004 05:25 PM
Re: Simple Simple question!!! ashelley@inlandkwpp.com ASP .Net 0 06-25-2004 04:18 PM



Advertisments