|
| |
User Groups : Forums : SiteExperts : XML Technologies
:  | Outputting specific child nodes in XSL I have two places where the same data is displayed but there are different rules for each place as to how they are displayed.
Place #1 has a template, matching on the node name, and is the main display for the data on the page.
Place #2 takes the same data, and attempts uses the mode attribute to have a specific case where it only outputs its text and a particular child node, and leaves out the rest of the child nodes.
Let me try to illustrate this as an example.
<mainnode> <parentnode1> Lots of text <child_node2>really really long paragraph that goes on forever and a day></child_node2> </parentnode1> <parentnode2> etc...
So, in summary, all that would be displayed would be this:
Lots of text with flashing colors!
One section will display everything in parentnode1, and another section will only display the text plus child_node1, but not child_node2. I have a template match to do the entire display (it's recursive and multiple nodes of the same name can be under child nodes) and am trying to figure out how to do use the "mode" attribute to create a section that only displays the text plus child_node1. Is this possible?
Here's what I have so far, but it only outputs the text, and completely ignores ALL of the rest of the nodes, and I need child_node1:
<xsl:apply-templates select="parentnode1" mode="chk_value" />
..
<xsl:template match="parentnode1" mode="chk_value"> <xsl:apply-templates mode="chk_value"/> </xsl:template>
<xsl:template match="text()" mode="chk_value"> <xsl:value-of select="." /> </xsl:template>
<xsl:template match="child_node2" mode="chk_value" />
<xsl:template match="child_node3" mode="chk_value" />
Help?
Thanks, AndreaStarted By kyrene on Jan 13, 2006 at 7:25:24 AM |  | | 1 Response(s) | Reply |
| View All Replies |  | | kyrene on Jan 13, 2006 at 7:55:40 AM Wait, left out one of the parts:
Wait, left out part of it:
<xsl:template match="child_node1" mode="chk_value"> <xsl:choose> <xsl:when test="@role='bold'"> <b><xsl:value-of select="." /></b> </xsl:when> <xsl:otherwise> <xsl:value-of select="." /> </xsl:otherwise> </xsl:choose> </xsl:template>
| | View All Replies |
To respond to a discussion, you must first logon.
If you are not registered, please register yourself to become a member of the SiteExperts.community.
|