Subject: [xsl] Choosing content depending on content of other element From: "Jochen Metzger" <j.metzger@xxxxxxxxxxxx> Date: Thu, 25 Jul 2002 09:53:05 +0200 |
Hi list, I think I'm stuck. I've been trying on the following problem, but I can't figure it out. I've merged two xml-trees. That's fine so far. No I have the nodes /root/output/data/product_id and order/product Depending on the product_id output, I wan't to choose the equivalent node /root/order/product/@id='xxx'/content/@group Example: When I have output So when /root/output/data/product_id => 404 I want to output all the equivalent /root/order/product/id='404'/content/@group Beneath there's the xml-tree. Beneath is also the current version of the xsl-stylesheet. I've tried so far (without) success: Why does it not work? Regards Jochen xml === <?xml version="1.0"?> <root> <output> <data> <ordernr>9026</ordernr> <productnr>PD1X404</productnr> <product_id>404</product_id> </data> <data> <ordernr>9026</ordernr> <productnr>PD1X405</productnr> <product_id>405</product_id> </data> </output> <order nr="9026"> <product id="404"> <content group="9026-P404-M402-1"> <shops_booked>4</shops_booked> <status_in_lang>in Bearbeitung</status_in_lang> </content> <content group="9026-P404-M402-2"> <shops_booked>2</shops_booked> <status_in_lang>Online</status_in_lang> </content> </product> <product id="405"> <content group="9026-P405-M402-1" /> </product> </order> </root> XSL ======= <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xhtml" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes" doctype-public="-//W3C/DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" standalone="yes" media-type="text/html" /> <xsl:template match="/"> <xsl:apply-templates select="/root/output" /> </xsl:template> <xsl:template match="/root/output"> <xsl:call-template name="line" /> </xsl:template> <xsl:template name="line"> <br/> <xsl:for-each select="data"> <br/><br/><b><small><u>Produkt</u></small></b><br/> <xsl:value-of select="productnr" /> <br/><b><small>Content-Gruppe</small></b> <xsl:apply-templates select="/root/order/product[@id='/root/output/data/product_id']"/> </xsl:for-each> </xsl:template> <xsl:template match="/root/order/product[@id='/root/output/data/product_id']"> <br/><xsl:value-of select="content/@group"/> </xsl:template> </xsl:stylesheet> xml === <?xml version="1.0"?> <root> <output> <data> <ordernr>9026</ordernr> <productnr>PD1X404</productnr> <product_id>404</product_id> </data> <data> <ordernr>9026</ordernr> <productnr>PD1X405</productnr> <product_id>405</product_id> </data> </output> <order nr="9026"> <product id="404"> <content group="9026-P404-M402-1"> <shops_booked>4</shops_booked> <status_in_lang>in Bearbeitung</status_in_lang> </content> <content group="9026-P404-M402-2"> <shops_booked>2</shops_booked> <status_in_lang>Online</status_in_lang> </content> </product> <product id="405"> <content group="9026-P405-M402-1" /> </product> </order> </root> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Evaluating parameter in <, Jeni Tennison | Thread | Re: [xsl] Choosing content dependin, Jeni Tennison |
[xsl] Evaluating parameter in <xsl:, Roelf Jansen | Date | [xsl] Inlude problems, Ragulf Pickaxe |
Month |