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

Nodes get new IDs in function?

Subject: Nodes get new IDs in function?
From: Martynas Jusevicius <martynas.jusevicius@xxxxxxxxx>
Date: Fri, 9 Apr 2010 02:15:14 +0200
 Nodes get new IDs in function?
Hey list,

still struggling with the level gap-infested ToC, but I think I
introduced a couple of functions, I'm now on the finish line:

<xsl:function name="o2e:heading-level" as="xs:integer">
    <xsl:param name="heading" as="element()"/>
    <xsl:value-of select="number(substring-after(local-name($heading), 'h'))"/>
</xsl:function>

<xsl:function name="o2e:parent-heading" as="element()*">
    <xsl:param name="heading" as="element()"/>
    <xsl:copy-of select="$heading/preceding-sibling::h:*[self::h:h1 or
self::h:h2 or self::h:h3 or self::h:h4 or self::h:h5 or
self::h:h6][o2e:heading-level(.) &lt;
o2e:heading-level($heading)][1]"/>
</xsl:function>

The problem is, it seems that nodes returned from the parent-heading()
function get different IDs than identical nodes in the source
document. Is this the specified behavior, i.e. functions construct new
nodes, which get new IDs?

For that reason this expression won't work:

following-sibling::h:*[self::h:h1 or self::h:h2 or self::h:h3 or
self::h:h4 or self::h:h5 or self::h:h6][o2e:parent-heading(.) is
current()]

Because the IDs won't match in the 'is' operator, even though I can
see the nodes are (look) identical. If I change the operator to '=' it
starts giving the expected results, but it is not good enough, as
there can be several heading elements with the same string value. Is
it possible to retain the original ID value somehow?

As for the source document, it could be any XHTML with any number and
order of headings, for example:

<h1 class="Heading_20_1 ">Free Culture - How Big Media Uses Technology
and the Law to Lock Down Culture and Control Creativity,Lawrence
Lessig</h1>
<h4 class="Heading_20_4 ">Attribution</h4>
<p>...</p>
<h3 class="Heading_20_3 ">Preface</h3>
<h4 class="Heading_20_4 ">[Preface]</h4>
<p>...</p>
<h3 class="Heading_20_3 ">INTRODUCTION</h3>
<p>...</p>

and so on

Martynas
odt2epub.com

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.