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 July 7th, 2006, 10:09 AM
Registered User
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading similar elements with different content

Hi all!

i got following problem

I have a xml file as input file and a corresponding xsl file which creats a simple txt file.

First of all the xml:



and the xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="ISO-8859-1" indent="no" omit-xml-declaration="yes" />

 <xsl:template match="/">

RunAsDaemon: yes

<xsl:for-each select="/componentlist/ccb/ip">

<xsl:text>ip = </xsl:text><xsl:value-of select="/componentlist/ccb/ip"/>


When i create the output file i will always get the same content
like this:
ip =
ip =

What have i to do to get something like this:
ip =
ip =

i tried some things like * or // but it wont really works :(

Could you please help me, it should be a trivial problem for you^^

Many thanks
and best regards

Old July 7th, 2006, 01:38 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts


<xsl:value-of select="/componentlist/ccb/ip"/>


<xsl:value-of select="."/>

xsl:for-each iterates over the selected elements by making each one the context node in turn. The way to get the element you are currently processing is ".". If you use a path expression starting with "/", you are selecting from the root of the document, and the result will be unrelated to where you are in the for-each iteration.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Similar Threads
Thread Thread Starter Forum Replies Last Post
Similar Page Content - Making "Generic" Pages robzyc ASP.NET 2.0 Basics 6 May 16th, 2008 09:06 AM
Websites content reading code like title of any we ali_ggl Javascript How-To 0 February 1st, 2008 08:58 AM
Appending set of elements after the similar nodes sesath XSLT 2 May 15th, 2007 10:16 AM
Choosing content depending on content of other ele dsekar_nat XSLT 1 February 27th, 2006 05:58 AM
Here is some similar problem amit_bhatia Beginning PHP 1 December 7th, 2004 11:30 AM

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