Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Can you embed XML in XSL and access it?

From: "johkar" <nosendjunk@---.--->
To: NULL
Date: 10/1/2006 9:28:00 AM


Martin Honnen wrote:
> johkar wrote:
>
> > I would like to embed some XML within my XSL as either a param or a
> > global variable.  Is this possible?  If so, what is the syntax to
> > access it?
>
> You can embed XML data as a top level element (child of the
> xsl:stylesheet element) if the element is in a different namespace e.g.
>
> <xsl:stylesheet
>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    xmlns:data="http://example.com/2006/some-data"
>    version="1.0">
>
> <data:data>
>    <links xmlns="">
>      <link>Link 1</link>
>      <link>Link 2</link>
>    </links>
> </data:data>
>
> The XSLT stylesheet itself can be accessed with calling the document
> function with '' e.g.
>    document('')
> so you would get at that data with e.g.
>    document('')/xsl:stylesheet/data:data/links/link
> to access all the link elements.
>
>
> If you use xsl:param or xsl:variable and have contents in these elements
> then you have a result tree fragment as the parameter or variable value
> that you can later copy to the result tree with xsl:copy-of e.g.
>
> <xsl:call-template name="securetemplate">
> <xsl:with-param name="leftnav">
>     <links>
>        <link>Link 1</link>
>        <link>Link 2</link>
>     </links>
> </xsl:with-param>
> </xsl:call-template>
>
> <xsl:template name="securetemplate">
>    <xsl:param name="leftnav"/>
>    <xsl:copy-of select="$leftnav"/>
> </xsl:template>
>

One more question.  If data:data is on the main page, how can you
access it in an included xsl?

John



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