Subject: Re: [xsl] Grouping repeating elements within repeating elements From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 09 Dec 2007 18:30:57 +0900 |
Strike what I had asked for before. I think I got that working. But now, I am running into another issue.
This code is basically building out an FAQ page. But my problem really is is that there are cases where there will be no headings (i.e. a parent node). If that is the case, I just need to display the questions and answers and bypass wrapping in a div tag that the values from the headings would produce.
I have it working now where if there are no headings, then just display the questions and answers. But unfourtunately, the xsl:if that I have in place is getting stepped into even by questions and answers that do have headings and they are showing up as duplicates.
The XML input below is still the same but the only variance is that I pull in the content_category_faq value and pass that value into a query to pull back all the XML objects that have value and thus display the questions and answers.
The code is attached below and I have it commented where a more effective if logic is needed.
I just can't seem to figure out how to get around the duplicate entries in the questions and answers where there are indeed headings.
Thank you so much for any suggestions.
<xsl:if test="string(heading[$index])"> <xsl:text disable-output-escaping="yes"><![CDATA[<a class='linkMore' href='#' onclick="ContentHiearchy_FAQ(']]></xsl:text> <xsl:value-of select="$generatingHeaderId"/> <xsl:text disable-output-escaping="yes"><![CDATA[')">]]></xsl:text> <xsl:value-of select="concat($indent,heading[$index])"/> <xsl:text disable-output-escaping="yes"><![CDATA[</a><br/> <DIV id="]]></xsl:text> <xsl:value-of select="$generatingHeaderId"/> <xsl:text disable-output-escaping="yes"><![CDATA[" class="content_hiearchy_hidden">]]></xsl:text> <!--determine if there is any information at the next level of depth--> <xsl:call-template name="next-heading"> <xsl:with-param name="index" select="$index + 1"/> <xsl:with-param name="indent" select="concat($indent,'   ')"/> <xsl:with-param name="faqs" select="$faqs[heading[$index]=
current()/heading[$index]]"/>
</xsl:call-template> <xsl:text disable-output-escaping="yes"><![CDATA[</div>]]></xsl:text> </xsl:if>
<xsl:if test="string(heading[$index])"> <a class='linkMore' href='#' onclick="ContentHiearchy_FAQ('{$generatingHeaderId}')"> <xsl:value-of select="concat($indent,heading[$index])"/> </a><br/> <div id="{$generatingHeaderId}" class="content_hiearchy_hidden"> <!--determine if there is any information at the next level of depth--> <xsl:call-template name="next-heading"> <xsl:with-param name="index" select="$index + 1"/> <xsl:with-param name="indent" select="concat($indent,'   ')"/> <xsl:with-param name="faqs" select="$faqs[heading[$index]= current()/heading[$index]]"/>
</xsl:call-template> </div> </xsl:if>
-- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping repeating elemen, Cynthia . Arangua | Thread | [xsl] XSLT extention problem, jingjun long |
Re: [xsl] Processing Instructions, Deborah Pickett | Date | [xsl] Body attributes, imap |
Month |