[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL copy-of problem with extraction of a node based on

Subject: XSL copy-of problem with extraction of a node based on child elem ent
From: "Carroll, David" <David.Carroll@xxxxxxxxxxx>
Date: Wed, 19 Jan 2005 20:32:10 -0800
xsl copy of
I wish to extract one subnode from an XML file based on the value of a child
element in the node. In this case a complete copy of a property node based
on the value of the index element. My efforts so far have either resulted in
the index element only or the entire XML file.

 

Thanks for your help.

 

David 

 

 

 

XML FILE

 

<?xml version="1.0" encoding="UTF-8"?>

<contents ver="1.0">

   <type>telop</type>

   <count>13</count>

   <property>

         <index>003000001</index>

         <cdate>2004-10-23 12:27:03.015</cdate>

         <size>34614</size>

         <info>Text</info>

         <title>UPDATE: 10 minute delay Concord to San F</title>

         <width>479</width>

         <height>24</height>

         <lineheight>24</lineheight>

         <format>BITMAP</format>

         <effect row="1" col="1">1</effect>

         <effect row="1" col="2">50</effect>

         <effect row="2" col="1">0</effect>

         <effect row="2" col="2">0</effect>

         <effect row="2" col="3">0</effect>

         <effect row="3" col="1">0</effect>

         <effect row="4" col="1">1</effect>

         <effect row="4" col="2">0x000000</effect>

   </property>

   <property>

         <index>003000002</index>

         <cdate>2004-10-20 17:20:16.078</cdate>

         <size>39606</size>

         <info>Text</info>

         <title>Buy your Commute Pass this week and save</title>

         <width>549</width>

         <height>24</height>

         <lineheight>24</lineheight>

         <format>BITMAP</format>

         <effect row="1" col="1">1</effect>

         <effect row="1" col="2">50</effect>

         <effect row="2" col="1">0</effect>

         <effect row="2" col="2">0</effect>

         <effect row="2" col="3">0</effect>

         <effect row="3" col="1">0</effect>

         <effect row="4" col="1">1</effect>

         <effect row="4" col="2">0x000000</effect>

   </property>

</contents>

__________________________________

 

XSL

 

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" indent="yes"/>

 

<xsl:template match="/">

<xsl:copy-of select="contents/property/index[. = '003000001']"/>

 </xsl:template>

</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.