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/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>



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