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

Re: Referencing a lookup table

Subject: Re: Referencing a lookup table
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Mon, 12 Jul 2004 03:25:08 -0600
xslt lookup table
Hi Gregor,

The archives for the list can be a difficult place to find indexed information and it seems you have had the pleasure of discovering this little tidbit of info for yourself. While the archive is immense and full of fantastic information from some really bright, talented, and experienced people unless you are an experienced XSLT developer it's pretty hard to know just what it is your searching for and how to pass the correct search phrase (both in syntax and content) to the search engine. Like we both are aware.... very frustrating!

Fortunately some of the founding members of both this list as well as XML/XSLT development community as a whole have made the task of finding this information MUCH easier. Although there are many more contributors the specific people I am referring to are (with corresponding links that will help get you going down the right track) as follows:

Dave Pawson - Over the years DaveP has seen pretty much every XSLT (and a lot of non-XSLT for that matter) related questions phrased in every possible way come through this list. While I can't say for sure what made him decide to initially begin the task of pulling out the unique questions and associated correct answers/solutions as they came through I do know that he has developed one of the most concise and precise FAQ's on the web. His is of course is XSLT specific but I mean that in a general terminology sense as well as you would be hard pressed to find a better FAQ for ANY technology.

The links:

Entry point(links to several areas to help get you started): http://www.dpawson.co.uk/xsl/
Main XSLT Q/A index: http://www.dpawson.co.uk/xsl/sect2/sect21.html


Jeni Tennison - Considered to be one of the premier experts in several areas of XML development, much like DaveP Dr. Tennison spends a TON of time helping people with XSLT specifics both directly through this list as well as (I want to say indirectly, but its not really indirect as you'll see when you visit her site - so I'll use...) directly through her XSLT pages where she both tackles and then simplifies some of the more complex areas of XSLT like grouping, string manipulation, conditional processing, etc... She has also developed several excellent tutorials to help get you started. Much can be learned in a very short period of time spent at her site and as such this is an excellent starting point for those trying to get a grasp of XSLT.


Entry point: http://www.jenitennison.com/
Main XSLT pages: http://www.jenitennison.com/


Michael Kay - Not enough can be said about Dr. Kay and his contribution to both this community and the XML development community as a whole. If you are unfamiliar with why a simple Google search will bring you to the light. Beyond creating the defacto standard for professional/production XSLT processors as an open source project (see http://www.saxonica.com) he has also written the defacto professional reference manual for XSLT (both 1.0 and the soon to be released 2.0 version - not to be confused with the 2nd edition of his XSLT 1.0 reference). If you dont happen to have a Barnes & Noble, Borders, B. Dalton, or any number of other local and national chain bookstores you can obtain a copy of the reference from Amazon.com. The link:


http://www.amazon.com/exec/obidos/ASIN/0764543814/ref=pd_cpt_gw_1/002-9068386-9335222


If I were to classify the above links I would do so as follows:


DaveP - Quick answers and lots of them but does require a bit of prep work to understand how and why some of the solutions work.

Dr. Jeni Tennison - Quick understandings of complex problems as well as access to tutorials to give you the base knowledge necessary to implement the solutions with confidence.

Dr. Michael Kay - Deep well of information that can be easily referenced complete with rock solid explanations that will develop your understanding of everything related to XML processing using XSLT (including multiple related technologies like SAX, DOM, JAXP, TrAX, etc...) to whatever level you desire to take it. If your an experienced programmer already you will quickly appreciate the amount of effort that went into this reference. And if you're a novice-to-intermediate developer you will appreciate the straight forward simplicity in which Dr. Kay's presents the material.


Ok, to help get you focused on the specifics of your question look through the areas of the the above links and through Dr. Kay's reference regarding selecting elements and there associated values using "XPath". (XPath is the internal path reference language used in many XML-based technologies including XSLT and is used to reference the structure of an XML document using a path like syntax similar to how you access a file system directory structure or a specific directory and/or page within the structure of a website). A couple hints to get you going in the right direction: xsl:for-each will loop through the subset of elements that have been selected using the XPath statement contained in its select attribute and allow you to process them further using logic contained within the opening and closing tag of xsl:for-each. xsl:value-of with give you the actual string literal value contained between the opening and closing brackets of the element selected. So the following:


<xsl:template match="/">

<xsl:for-each select="foo/bar">
	Value of element "bar" is: <xsl:value-of select="."/><br/>
</xsl:for-each>

</xsl:template>

Will process the following XML structure:

<foo>
	<bar>value 1</bar>
	<bar>value 2</bar>
</foo>

And output:

Value of element "bar" is: value 1<br/>
Value of element "bar" is: value 2<br/>

As you will learn, using "." for the value of the select attribute will output the string literal value of the current context node in the loop.


Well, this should definitely be enough information to help get you started down your path of conquering XSLT. And dont hesitate to ask questions as you are going through the process as this is the sole purpose of this list. With the above references you may very well never need to ask another XSLT-related question again but don't hesitate if you just can't find the answer or the answer you find is just not sufficient to your needs or is difficult to understand. We've all been there and most of us come from hard core development backgrounds and yet still had to spend our time with Dave's, Jeni's, and Michael's references until that day when it finally clicked (and yet most of us still use these for help with our XSLT development). And it will :)


Best of luck!

<M:D/>



Sips, Gregor wrote:
Hi !

I am relatively new in the world of XML and XSL, so my problem has probably been adressed before. I have been looking in the archive but couldn't find any solution.
Well, the point is that I have some XML-tags added to an original XML message. The result looks like this:

<document>
<!-- original tags -->
<policy>
<cover>
<fundcode>1</fundcode>
<amount>120</amount>
<some_other_stuff/>
</cover>
<cover>
<fundcode>2</fundcode>
<amount>80</amount>
<some_other_stuff/>
</cover>
</policy>
<!-- addes tags -->
<funds>
<fund>
<code>1</code>
<desc>Fund 1</desc>
</fund>
<fund>
<code>2</code>
<desc>Fund 2</desc>
</fund>
</funds>
</document>


I want te create a XHTML where I select form the cover node the funds including the corresponding description in the added tags section. I have been struggling with all kinds of combinations of value-of and for-each elements but so far no result. Is there anybody who can help me ?

Kind regards,
Gregor Sips
De in dit e-mailbericht verstrekte informatie (inclusief attachments) is vertrouwelijk en uitsluitend bestemd voor de geadresseerde. Het gebruik door derden of het verstrekken aan derden van deze informatie dan wel kopikren van deze informatie is niet toegestaan.
Vanwege de elektronische verzending kunnen er geen rechten worden ontleend aan de informatie in dit bericht.
Dit e-mailbericht is gecontroleerd op aanwezigheid van computervirussen.


The information provided in this e-mailmessage (including attachments) is confidential and intended solely for the adressee. The use by third-parties or the providing to third-parties of this information or the copying of this information is not allowed. Because of the electronic sending no rights can be derived from the information in this message. This e-mailmessage has been checked for the presence of computer viruses.

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.