Click here to Skip to main content
       

Web Development

 
GeneralRe: JSP and JSTL and so on ... PinmemberSheraX11-Dec-12 7:12 
QuestionSMTP Programming PinmemberDisIsHoody9-Dec-12 13:49 
AnswerRe: SMTP Programming Pinmembervbmike10-Dec-12 8:49 
GeneralRe: SMTP Programming PinmemberDisIsHoody10-Dec-12 13:30 
GeneralRe: SMTP Programming PinmvpRichard MacCutchan10-Dec-12 21:36 
GeneralRe: SMTP Programming PinmemberDisIsHoody11-Dec-12 9:40 
GeneralRe: SMTP Programming PinmvpRichard MacCutchan11-Dec-12 10:26 
GeneralRe: SMTP Programming PinmemberDisIsHoody11-Dec-12 10:44 
GeneralRe: SMTP Programming PinmvpRichard MacCutchan11-Dec-12 10:58 
GeneralRe: SMTP Programming PinmemberDisIsHoody11-Dec-12 11:20 
QuestionXSLT Transforms - how to get just some of in a for-each PinmemberQuickBooksDev8-Dec-12 2:26 
AnswerRe: XSLT Transforms - how to get just some of in a for-each PinmemberChris Grove13-Dec-12 19:46 
GeneralRe: XSLT Transforms - how to get just some of in a for-each [modified] PinmemberQuickBooksDev17-Dec-12 0:42 
GeneralRe: XSLT Transforms - how to get just some of in a for-each PinmemberChris Grove17-Dec-12 3:43 
Hi,
I haven't done anything like this before but I did a quick bit of hunting around and something like this might do it for you. Please note this is totally untested and is just an idea. I thought about how to do a while or a normal for loop in XSL and then try and find away of checking if the element at position x existed. This is cobbled together from a couple of SO posts and my own take on how to put it together.
 
Sources:
http://stackoverflow.com/questions/11127693/how-to-do-a-while-like-loop-in-xslt[^]
http://stackoverflow.com/questions/5791053/xslt-if-tag-exists-apply-template-if-not-choose-static-value[^]
http://www.sourceware.org/ml/xsl-list/2000-08/msg01503.html[^]
 
From those articles this is what I have cobbled together:
<xsl:template name="for_loop">
	<xsl:param name="num">1</xsl:param> <!-- param has initial value of 1 -->
	<xsl:param name="limit"></xsl:param> <!-- this should be the expected number of opt elements, passed into the template -->
	<xsl:if test="not($num = $limit)">
		<xsl:choose>
			<xsl:when test="not(opt[position() = $num)"> <!-- true if the element DOES NOT exist -->
				<!-- create your empty xml here -->
			</xsl:when>
			<xsl:otherwise>
				<!-- the element exists get the data and output that -->
			</xsl:otherwise>
		</xsl:choose>
		<xsl:call-template name="for_loop">
			<xsl:with-param name="num">
				<xsl:value-of select="$num + 1">
			</xsl:with-param>
                        <xsl:with-param name="limit">
				<xsl:value-of select="$limit">
			</xsl:with-param>
		</xsl:call-template>
	</xsl:if>
</xsl:template>
 
Hope this helps.
 
Chris
GeneralRe: XSLT Transforms - how to get just some of in a for-each PinmemberQuickBooksDev17-Dec-12 4:55 
GeneralRe: XSLT Transforms - how to get just some of in a for-each PinmemberChris Grove17-Dec-12 5:43 
QuestionPop Up JQuery Quick Link PinmemberJaniel Major5-Dec-12 22:02 
AnswerRe: Pop Up JQuery Quick Link Pinmembervbmike7-Dec-12 4:09 
AnswerRe: Pop Up JQuery Quick Link Pinmemberryanb3112-Dec-12 4:41 
Question[HELP] Whois can using PHP to generate this one? Pinmemberjimmy.suharry4-Dec-12 21:37 
AnswerRe: [HELP] Whois can using PHP to generate this one? PinmemberS.M. Zamshed Farhan12-Jan-13 5:54 
QuestionTool for big WEB project with huge loads PinmemberJunoli2-Dec-12 9:37 
AnswerRe: Tool for big WEB project with huge loads PinmemberRichard A. Abbott2-Dec-12 10:47 
Questionselect an item in gridview Pinmemberptvce2-Dec-12 1:50 
AnswerRe: select an item in gridview PinmvpRichard MacCutchan2-Dec-12 3:00 
Questioni php question Pinmembergamaan1-Dec-12 4:00 
AnswerRe: i php question Pinmembergamaan1-Dec-12 4:03 
AnswerRe: i php question PinmemberS.M. Zamshed Farhan12-Jan-13 6:03 
QuestionHTML PinmemberDivyamS30-Nov-12 19:35 
AnswerRe: HTML PinmemberS.M. Zamshed Farhan15-Jan-13 4:21 
Questionthe protocol 'net.pipe' is not supported-WCF Pinmembermallikharjuna22128-Nov-12 0:50 
AnswerRe: the protocol 'net.pipe' is not supported-WCF PinmemberRichard A. Abbott28-Nov-12 1:38 
GeneralRe: the protocol 'net.pipe' is not supported-WCF Pinmembermallikharjuna22128-Nov-12 2:34 
GeneralRe: the protocol 'net.pipe' is not supported-WCF PinmemberRichard A. Abbott28-Nov-12 3:11 
Questionhow to get data when using header('location:'.$url) ??? Pinmemberaa_zz26-Nov-12 4:27 
AnswerRe: how to get data when using header('location:'.$url) ??? PinmemberS.M. Zamshed Farhan15-Jan-13 4:24 
QuestionWeb technologies PinmemberJunoli25-Nov-12 11:28 
SuggestionRe: Web technologies PinmemberJon Andersson29-Nov-12 10:21 
Questionbreak-word CSS PinmemberJon Andersson23-Nov-12 7:15 
AnswerRe: break-word CSS Pinmembervbmike24-Nov-12 4:08 
GeneralRe: break-word CSS PinmemberJon Andersson24-Nov-12 13:13 
GeneralRe: break-word CSS Pinmembervbmike29-Nov-12 9:58 
GeneralRe: break-word CSS PinmemberJon Andersson29-Nov-12 10:04 
GeneralRe: break-word CSS Pinmembervbmike29-Nov-12 10:10 
AnswerRe: break-word CSS PinmemberJon Andersson29-Nov-12 10:14 
GeneralRe: break-word CSS Pinmembervbmike29-Nov-12 11:06 
GeneralRe: break-word CSS PinmemberRichard A. Abbott29-Nov-12 12:00 
AnswerRe: break-word CSS PinmemberJon Andersson29-Nov-12 19:33 
GeneralRe: break-word CSS Pinmembervbmike30-Nov-12 9:17 
GeneralRe: break-word CSS PinmemberRichard A. Abbott30-Nov-12 9:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.140926.1 | Last Updated 28 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid