Subject: [xsl] recursive parsing? From: Janning Vygen <vygen@xxxxxxxxxxxx> Date: Fri, 20 Jul 2001 19:40:10 +0200 |
i asked it before but i still cant get it to work. Maybe there is some misunderstanding of xSL?? I hope not :-) <book> <chapter id="ch1"> <title>Example</title> <itemizedlist> <listitem>example a</listitem> <listitem>example b</listitem> <listitem>example c</listitem> </itemizedlist> </chapter> <chapter id="ch2"> <title>Example</title> <itemizedlist> <listitem>example d</listitem> <listitem>example e</listitem> <listitem>example f</listitem> </itemizedlist> </chapter> <chapter> <ext:sitemap/> <!-- ^^^^^^ important --> </chapter> </book> i am using a docbook stylesheet. inveting the ext:sitemap tag where i want to put a sitemap. the sitemap should be designed just like a itemizedlist. so i want my stylesheet to match ext:sitemap and to generate xml like this: <book> <chapter id="ch1"> <title>Examples 1</title> <itemizedlist> <listitem>example a</listitem> <listitem>example b</listitem> <listitem>example c</listitem> </itemizedlist> </chapter> <chapter id="ch2"> <title>Examples 2</title> <itemizedlist> <listitem>example d</listitem> <listitem>example e</listitem> <listitem>example f</listitem> </itemizedlist> </chapter> <chapter id="sitemap"> <title>Sitemap</title> <itemizedlist> <listitem><link linkend="ch1">Examples 1</link></listitem> <listitem><link linkend="ch2">Examples 2</link></listitem> <listitem><link linkend="sitemap">Sitemap</link></listitem> </itemizedlist> </chapter> </book> then in phase two i could parse it again with my genric docbook stylesheet. THIS IS EASY TO DO! But then i always have to parse the whole document and always generate the sitemap. it takes about 5 Minutes on a huge website. not very smart SO HOW ABOUT THIS: I want to split all chapters to chunks and i want just to parse only one chunk at a time given a rootid parameter like it is shown in the docbook xsl (html/chunk.xsl ) <xsl:template match="/"> <xsl:choose> <xsl:when test="$rootid != ''"> <xsl:choose> <xsl:when test="count(id($rootid)) = 0"> <xsl:message terminate="yes">not found</xsl:message> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="id($rootid)"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:template> That nice and it works, but i just cant get it to work if i only want to parse a specific chapter because you cant say: [...] <xsl:otherwise> <xsl:variable name="phase1"> <xsl:apply-templates select="id($rootid)" mode="phase1"> </xsl:variable> <xsl:apply-templates select="$phase1"> </xsl:otherwise> [...] in the second step the rest of the document went out of scope!! I have lots of trouble with this. I would like to parse some tags and send the output back to the input tree. I have always trouble with fraction node trees. If you have a fraction node tree like this you cant parse it anymore with <xsl:apply-templates select="$nodetree"> because all the links will break. <itemizedlist> <listitem><link linkend="ch1">Examples 1</link></listitem> <listitem><link linkend="ch2">Examples 2</link></listitem> <listitem><link linkend="sitemap">Sitemap</link></listitem> </itemizedlist> i dont know if you got the point but i really hate it that i just cant do it like this: <template match="ext:sitemap"> <xsl:variable name="phase1"> <xsl:call-template name="generate-sitemap"> </xsl:variable> <!-- $phase1 has now fragment node tree <itemizedlist> <listitem><link linkend="ch1">Examples 1</link></listitem> <listitem><link linkend="ch2">Examples 2</link></listitem> <listitem><link linkend="sitemap">Sitemap</link></listitem> --> <xsl:apply-templates select="$phase1"> </itemizedlist> </template> IF this would work everything would be fine to me! But it dont and i cant get a work around which fits my needs. Please help, cause i am dazed and confused about all this xsl. janning XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] document() as extension m, Michael Kay | Thread | [xsl] gettin value of a node, Earl Spencer |
RE: [xsl] Getting date of the XSL t, Mulberry Technologie | Date | [xsl] DOCTYPE/DTD, Samina Islam |
Month |