|
[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
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








