This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]