Selecting a 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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format