Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2014, 06:39 AM
Registered User
 
Join Date: Apr 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Post loop through array variable and create nodes using xsl

Hello,
I am creating an xml file through the xsl

I have an xsl variable which have the value as a string array. Now i need to loop through the array variable and create xml nodes. Following is my code.

<xsl:variable name="_arrInspectionTimes" select="(scripts:GetInspectionTime(normalize-space(openhouses/openhouse/openhouse_start), normalize-space(openhouses/openhouse/openhouse_end)))">
</xsl:variable>

<xsl:element name="inspectionTimes">
<xsl:for-each select="$_arrInspectionTimes">
<xsl:element name="inspection">
<xsl:value-of disable-output-escaping="yes" select="."/>
</xsl:element>
</xsl:for-each>
</xsl:element>


I am not able to render the nodes inside the loop. Can anyone help?
output is simply <inspectionTimes/> closed node. I confirmed the returned values in the string[] they are proper. Thanks in advance.

Last edited by shubhambhave; April 4th, 2014 at 07:03 AM..
 
Old April 4th, 2014, 07:23 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Are you using XSLT 1.0 or 2.0?

XSLT 1.0 does not have a "string array" type.

XSLT 2.0 has "sequences of strings" - is this what you are referring to?

Which XSLT processor are you using?

What does the extension function scripts:GetInspectionTime do?

The evidence suggests that your variable _arrInspectionTimes contains an empty sequence (or if it's 1.0, and empty node-set), and if you believe that isn't the case, then you need to convince your readers why.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Array Loop skipping loop in VBA jeskit Access VBA 5 March 20th, 2012 10:03 AM
Loop twice, then inside loop select nodes?? JohnBampton XSLT 2 March 9th, 2009 05:21 AM
XSL Loop and incrementing a variable 2007-03-29 XSLT 8 March 30th, 2007 10:41 AM
create array for loop in FSO jfergy Classic ASP Professional 4 April 14th, 2006 09:59 PM
Loop issue - with n number of same nodes.. ramesh.kumarm XSLT 3 March 8th, 2006 08:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.