Subject: using xsl-attributes for apply-template select From: Knut Alboldt <alboldt@xxxxxxx> Date: Mon, 2 Oct 2000 17:36:37 +0200 (MEST) |
Hi ! Giving the following sample xml: <?xml version="1.0"?> <docstructure> <define id="test1"> This is defined in test1 </define> <define id="test2"> This is defined in test2 </define> <text> text before test1 <include defined="test1"/> text after test1 text before test2 <include defined="test2"/> test after test2 <text> </docstructure> I want to show the text defined within the <defined>-tag by the <include>-tag (usage as a kind of textmacros within xml-file) where the "id" of the "define"-tag should be specified by the attribute "defined" of "include"-tag. How can I do a variable select in the apply-templates-tag ? === I tried to use the following xsl: <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <!-- process all within <text>-tags --> <xsl:template match="/docstructure/text"> <xsl:apply-template /> </xsl:template> <xsl:template match="text"> <xsl:apply-template /> </xsl:template> <!-- this one should select the define-tag, which id is specified by the defined-attribute of the include-tag --> <xsl:template match="include"> TEST INCLUDE DEFINED, ID=<xsl:value-of select="@defined" /> <xsl:apply-templates select="/docstructure/define[@id='{@defined}']"/> </xsl:template> <xsl:template match="define"> <xsl:apply-templates /> </xsl:template> <xsl:template match="text()"> <xsl:value-of select="." /> </xsl:template> </xsl:stylesheet> That does'nt work. To test I've used <xsl:apply-templates select="/docstructure/define[@id='test1']"/> which includes always the text defined within <define id="test1"> Please, can somebody help me ? Knut -- Sent through GMX FreeMail - http://www.gmx.net XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Microsoft MSXML September Relea, Julian Reschke | Thread | Re: using xsl-attributes for apply-, David Carlisle |
Applying templates to Result Tree F, James Lynn | Date | RE: Applying templates to Result Tr, James Lynn |
Month |