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

how to replace an XML tag with a result tree and parse

Subject: how to replace an XML tag with a result tree and parse it again
From: Janning Vygen <vygen@xxxxxxxxxxxx>
Date: Tue, 29 May 2001 13:25:10 +0200
replace tag xml
Hi

i have some difficulties with the following problem:

In my xml i invented a tag like this:
<toc level="2"/>

to indicate where to put a table of contents, so i dont want to put ToC 
automatically. only if the author wants to show it.

in my xsl i am trying to do this:

transform the toc tag into xml again which has the same DTD as the source 
document.

if dtd is something like docbook i would like to replace

<toc level=2"/>

with

<itemizedlist>
  <listitem>Chapter 1</listitem>
  <listitem> Chapter 2</listitem>
  ...
</itemizedlist> 

i put this result tree in a varaible like 
<xsl:variable name="mytoc">
  <itemizedlist>
    <listitem>Chapter 1</listitem>
    <listitem> Chapter 2</listitem>
    ...
  </itemizedlist> 
</xsl:varaible>
(of course it looks more comlicated, just simplifying things)

then i try to

<xsl:apply-templates select="$mytoc"/>

it works, but the tree in $mytoc has no knowledge about the input tree in 
xml. so if my <itemizedlist> needs to know to which bookset it belongs
to do things like this

<a>
  <xsl:attribute name="class">
    <xsl:value-of select="ancestor-or-self::set/@id"/>
  </xsl:attribute>
 ...
</a>

then i am in trouble, because the tree in $mytoc doesnt belong to the main 
xml tree. So here is my question: How can i achieve that templates replace 
something in the input tree and the Stylesheet behaves as it was always there?

thanks in advance 
janning

-- 
Planwerk 6 /websolutions
Herzogstraße 86
40215 Düsseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

 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.