[xsl] Selecting a Element by ID

Subject: [xsl] Selecting a Element by ID
From: Andreas Grytz <agrytz@xxxxxxxxxxxxx>
Date: Fri, 6 Feb 2004 13:08:12 +0100
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 -->

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

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

<?xml version="1.0" encoding="ISO-8859-1"?>
<p>Here goes the first paragraph.</p>
<p>Here goes the second paragraph.</p>

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


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