Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Is it possible to have array like thing in xslt

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/9/2009 1:15:00 PM
Manish Bafna wrote:
> I have only html,javascript,xslt and xml as development tools.That is we are 
> required to develop using just javascript and xslt

In XSLT there are no arrays, you can however pass a node-set around. It 
is also possible to store data in your stylesheet e.g.

<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0"
   xmlns:md="http://example.com/2009/mydata"
   exclude-result-prefixes="md">

   <xsl:output method="html" indent="yes"/>

   <md:data>
     <item-list xmlns="">
       <item>foo</item>
       <item>bar</item>
       <item>baz</item>
       <item>foobar</item>
     </item-list>
   </md:data>

   <xsl:template match="/">
     <html lang="en">
       <head>
         <title>Example</title>
       </head>
       <body>
         <xsl:apply-templates 
select="document('')/xsl:stylesheet/md:data/item-list"/>
       </body>
     </html>
   </xsl:template>

   <xsl:template match="item-list">
     <ul>
       <xsl:apply-templates select="item"/>
     </ul>
   </xsl:template>

   <xsl:template match="item">
     <li><xsl:value-of select="."/></li>
   </xsl:template>

</xsl:stylesheet>


So in that stylesheet document('')/xsl:stylesheet/md:data access the 
data stored in the stylesheet and you can apply templates to that data 
or pass it as a parameter to templates.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent