Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2006, 02:32 PM
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default "for-the-current-node" instead of "for-each" ?

Hello everyone. Currently I have this code here

<xsl:for-each select="*[contains(@class,' topic/topic ')]">
<xsl:value-of select="*[contains(@class,' topic/title ')]">
</xsl:value-of>
</xsl:for-each>

parsing my ENTIRE XML file and generating a TOC which lists the topic (i.e. chapter) titles.

I am trying to modify the code so that it simply displays the title of the current topic. In other words, I need to replace the "for-each" with some sort of "for-the-current select..." This would then be used to display the current chapter title in the header.

Any suggestions?


 
Old August 25th, 2006, 02:40 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This is a question about context, and it can't be answered without knowing more about the structure of your document and your overall stylesheet. If the current node is a title element then you can display its value using <xsl:value-of select="."/>, but I doubt that's what you're asking.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old August 25th, 2006, 02:55 PM
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There are actually 3 parts to the structure...

The title of the Chapter is pulled from a container file. For example:

chap1.xml:

<concept id="chap1">
<title>Chapter 1</title>
<conbody id="chap1_body">
</conbody></concept>

Here is the structure of the content files:

content.xml:

<concept id="content">
<title>Content</title>
<conbody id="content_body">
</conbody></concept>

Finally, a DITA map wraps the chapter container around the content:

<chapter href="chap1.xml">

<topicref href="content.xml" />

</chapter>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare current value with previous parent node ratjetoes XSLT 2 July 17th, 2008 06:15 AM
Please help to check the current node... darshil XSLT 1 May 9th, 2007 02:42 AM
Position of a node outside current context QuickSilver002 XSLT 2 April 19th, 2007 02:07 PM
XSLT Going up a level from current node. lafilip XSLT 4 February 23rd, 2007 03:06 PM
Copy all contents except current node in XSLT 2BOrNot2B XSLT 2 December 19th, 2006 06:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.