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

Selecting a Element by ID

Subject: Selecting a Element by ID
From: Andreas Grytz <agrytz@xxxxxxxxxxxxx>
Date: Fri, 6 Feb 2004 13:08:12 +0100
element by id
Hi everybody,

I am working on a document structure, which contains serveral elements
called "letter" and some elements called answer. The answers are
connected to the letters by an ID.

The following code tests wether there is an answer. But I am completly
have no idea, how to insert the content of that special answer.

  <xsl:for-each select="letter">
    <xsl:sort select="@year" />
    <xsl:sort select="@month" />
    <xsl:sort select="@page" />
    <xsl:call-template name="letter"/>
    <xsl:if test="/article/answer/@ref=@id">
	<!-- The test returns 'true' -->
        <!-- Here should be the answer -->
    </xsl:if>
  </xsl:for-each>

I think tried, several things but nothing worked. So, the human way to
select the answer is to say: "Get the answer, where the Attribute 'ref'
is equal to the Attribute 'id' in this letter." But I can not transform
this.

My problem ist also, that the answer contains one or more paragraphs
surrounded with <p></p>. This elements have to be transformed.

If sample data ist needed, drop me a mail. But the element is very
simple:

<?xml version="1.0" encoding="ISO-8859-1"?>
<article>
<letter
	month="02"
	year="2004"
	page="78"
	id="foo">
<p>Here goes the first paragraph.</p>
<p>Here goes the second paragraph.</p>
</letter>

<answer	ref="foo">
<p>Here goes the first paragraph.</p>
<p>Here goes the second paragraph.</p>
</answer>
</article>

Regards,
Andreas

-- 
Andreas Grytz		| http://www.linuxnewmedia.de
Stefan-George-Ring 24	| Tel:	+49 (0) 89 993411-0
D-81929 München		| Fax:	+49 (0) 89 993411-99

 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.