Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Can you embed XML in XSL and access it? >Thread Next - Re: Can you embed XML in XSL and access it? Re: Can you embed XML in XSL and access it?To: NULL Date: 10/2/2006 9:26:00 AM
Joe Kesselman wrote:
> johkar wrote:
> > One more question. If data:data is on the main page, how can you
> > access it in an included xsl?
>
> I'm not sure what you mean by "main page" in this context. The main
> stylesheet? If you know the URI for that stylesheet, you can ask the
> document function to retrieve from that specific URI. If you don't know
> the URI, you may have to pass it down as a parameter ... or just pass a
> reference to that data:data element down as a parameter.
I have only been able to get one scenario to work, if I have the
data:data namespace and the document function on the same stylesheet.
If I want to output various nodes from the data:data XML from and
included stylesheet, I cannot get it to work. I have tried passing
references and other things suggested, but my syntax is apparently
incorrect. We use Xalan if that makes a difference. Below is an
example.
Thanks, John
Main template
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:data="http://example.com/2006/some-data">
<xsl:include href="common/leftcol.xsl" />
<data:data>
<links xmlns="">
<link name="selected">Link 1</link>
<link>Link 2</link>
</links>
</data:data>
<xsl:template match="/">
<xsl:call-template name="leftcol" />
</xsl:template>
</xsl:stylesheet>
Left Column Template
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:data="http://example.com/2006/some-data">
<xsl:template name="leftcol">
<xsl:value-of
select="document(common/mainPage.xsl)/data:data/links/link[@name='selected']"
/>
</xsl:template>
</xsl:stylesheet>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
