[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Ralph,
You're almost there; you only have to fix a couple of little errors:
At 06:04 PM 4/11/2002, you wrote:
This should be select="document('itn.xml')". As it stands it is taking the value of the <itn.xml> element child of the context node as its argument. Since you have none, it comes back empty.
The select="$itn/logo" looks good *except* your node set has a root node above the <itn> element, so there is no such node (no <logo> child of the root node). select="$itn/itn/logo" will work (or just set your variable to document('itn.xml')/itn to begin with.
This will work fine.
$itn//logo will work, though be less efficient than $itn/itn/log or $itn/*/logo.
No, you get it, you just have some syntax buglets.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] after use of document(): selecting parts of the obtained node-set
Subject: Re: [xsl] after use of document(): selecting parts of the obtained node-set From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 11 Apr 2002 18:15:51 -0400 |
Ralph,
You're almost there; you only have to fix a couple of little errors:
At 06:04 PM 4/11/2002, you wrote:
I use the document function to load a document from within a stylesheet, and store the resulting nodeset in a variable:
<xsl:variable name="itn" select="document(itn.xml)" />
This should be select="document('itn.xml')". As it stands it is taking the value of the <itn.xml> element child of the context node as its argument. Since you have none, it comes back empty.
Now I'd like to access certain parts of this nodeset, like this:
<xsl:template>
...
<xsl:apply-templates select="$itn/logo" />
...
</xsl:template>
The select="$itn/logo" looks good *except* your node set has a root node above the <itn> element, so there is no such node (no <logo> child of the root node). select="$itn/itn/logo" will work (or just set your variable to document('itn.xml')/itn to begin with.
and for the sub-nodeset $itn/logo I have the following template:
<xsl:template match="itn/logo"> extract data </xsl>
This will work fine.
Unfortunately, whenever I try this combination, the result of my <xsl:apply-templates select="$itn/logo"> is empty. The same is true when I do a select like <xsl:apply-templates select="$itn//logo">.
$itn//logo will work, though be less efficient than $itn/itn/log or $itn/*/logo.
Maybe I haven't understood the functionality of document() or how to access parts of a node set that is returned by document()? Can someone help me, please?
No, you get it, you just have some syntax buglets.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] after use of document(): sele, Ralph Holz | Thread | Re: [xsl] after use of document(): , Joerg Heinicke |
[xsl] after use of document(): sele, Ralph Holz | Date | Re: [xsl] after use of document(): , Joerg Heinicke |
Month |
Keywords