Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Help with writing select data [Thread Next] Re: Help with writing select dataTo: NULL Date: 11/3/2006 8:09:00 PM Patrick wrote: > I am working with global variables. Sorry, I did misread your question. I should learn not to type when tired... > <xsl:variable name="moorname" select="'C10AB'" > > <html> > <body> > <xsl:call-template name="show_moor"> > <xsl:with-param name="moornameToSelect" /> > </xsl:call-template> > </body> > </html> > </xsl:variable> This is a problem. You are simultaneously trying to set $moorname to the literal string C10AB and to contain a Result Tree Fragment which is your little <html>...</html> block. You can't do both; the variable can have only one value, and according to the XSLT spec this block of code is an error -- if the select attribute is specified, the content MUST be empty. So your first step should be replace that with something legal. Get rid of either the contents, or the select. Next step: Decide what your calling sequence is supposed to be here. Are you really trying to call the same template to build a result tree fragment in a variable -- which then gets used only to extract the text nodes back out of it, since that's the definition of value-of when applied to an RTF -- and as the root template which attempts to use the result of that variable? Think through what you're trying to do -- write it out in English -- and then write the code to match it; what you've got here really does not make any sense, independent of the global-variable issue. The parameter you're passing (moornameToSelect) is empty, and unused, > > <xsl:template name="show_moor" match="/"> > <xsl:param name="moornameToSelect" /> > <xsl:for-each select="active_wfs/deployment"> > <p>Moorname: <xsl:value-of select="$moorname " /></p> > <p>Moortype: <xsl:value-of select="moortype " /></p> > <p>Latitude: <xsl:value-of select="lat" /></p> > <p>Longitude: <xsl:value-of select="lon" /></p> > <p>Start: <xsl:value-of select="start" /></p> > <p>End: <xsl:value-of select="end" /></p> > </xsl:for-each> > </xsl:template> > > </xsl:stylesheet> > -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
