Subject: RE: [xsl] determining position of a document included using document function From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 13 Feb 2002 13:03:49 -0500 |
I run stylesheet1 against document1, document1 has a structure sort of like in all the classic "xinclude with xslt" examples: i.e <doc> <file href="document2.xml"/> <file href="document3.xml"/> </doc> so when I get to the file node I use the document function as above to load the document referred to by the href attribute, then I apply-templates against that document, however I found in the document I loaded at one point I would really have liked to know something about the position of the file node which had the attribute href from which I knew what document to load! :)
<xsl:template match="file"> <xsl:value-of select="position()"/> </xsl:template>
<xsl:apply-templates/> <= position() returns 4 unless you're stripping space inside 'doc' in which case it's 2
I can actually see where that might get very useful to know, or the knowledge of what file's parent is, in cases where I load a document into the middle of another one, which I do often, and I suppose others do as well.
Obviously that could be done by passing a parameter but what if, as in this case, I need to apply-templates five or six times before I get to the actual template I need the info in.
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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] determining position of a, Bryan Rasmussen | Thread | Re: [xsl] determining position of a, Jeni Tennison |
Re: [xsl] How to define a global pa, Thomas B. Passin | Date | [xsl] XSLT: SUM function Not work, Ragan, Mitch |
Month |