[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

using xsl-attributes for apply-template select

Subject: using xsl-attributes for apply-template select
From: Knut Alboldt <alboldt@xxxxxxx>
Date: Mon, 2 Oct 2000 17:36:37 +0200 (MEST)
apply template select
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.