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

Subject: [xsl] 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
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:


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

Hope this helps.


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

 <section id="EAF" >

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"/>

Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices

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

Current Thread