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

Re: I'm very new to the XML/XSL world ...

Subject: Re: I'm very new to the XML/XSL world ...
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx (by way of B. Tommie Usdin)
Date: Tue, 17 Apr 2001 09:47:10 -0400
 Re: I'm very new to the XML/XSL world ...
Date: Tue, 17 Apr 2001 06:34:44 -0700 (PDT)
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Subject: Re: I'm very new to the XML/XSL world ...
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
In-Reply-To: <200104170630.CAA09488@xxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii


>I'm very new to the XML/XSL world. 

Who isn't?

>I want to use XSL in a similar fashion to a database query.

You need XQuery for that, but XSLT/XPath can do the job.

Try the enclosed. You may need to use the function normalize-space()
to deal with the white space within you elements " A Person ". I
just ignored it to concentrate on the XPath issues. In understanding
the XPath you simply need to know that the text outside of the []'s
steers you to the node you are selecting, while the text within the
[]' qualifies what nodes are selected:

You can obtain the sec_head for a given $title as a two step process.

First, select the sec_ref attribute of graph elements where the 
graph element a has title element wich content equal to $title:

   select="//graph[title=$title]/@sec_ref"/>

Second select the sec_head element within a section element with an id 
attribute equal to $sec_ref:

   select="//section[@id=$sec_ref]/sec_head"/>
 
Hope this helps.

Regards,

Dan
File: IDProblem17April2001.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="IDProblem17April2001.xsl"?>
<graph_catalogue>
 <graph sec_ref="EAF"  >
  <title>Graph</title>
 </graph>

 <section id="EAF" >
  <sec_head>Person</sec_head>
 </section>
</graph_catalogue>

File: IDProblem17April2001.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
 <xsl:variable name="title" select="'Graph'"/>
 <xsl:template match="/">
  <xsl:variable name="sec_ref" select="//graph[title=$title]/@sec_ref"/>
  <xsl:value-of select="//section[@id=$sec_ref]/sec_head"/>
 </xsl:template>
</xsl:stylesheet>


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.