| 
 
Subject: Re: [xsl] Unwrapping trees From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 13 Jun 2002 16:32:58 +0100  | 
Hi Norm,
> Has anyone written the XSLT required to "unwrap" nested links?
I say "use SAX". This kind of transformation is really much better
suited to a event-driven paradigm than XSLT's declarative access.
If I had to use XSLT for some reason, then I'd do a two-step
transformation. First, create a flattened start/end structure,
something like:
<p>
  text
  <evt:start evt:name="a" href="1" />
  text
  <evt:end evt:name="a" />
  <evt:start evt:name="span" />
  <evt:start evt:name="a" href="2" />test<evt:end evt:name="a" />
  text
  <evt:end evt:name="span" />
  <evt:start evt:name="a" href="1" />
  text
  <evt:end evt:name="a" />
  text
</p>
Then use the usual methods to group that structure into the desired:
<p>
  text
  <a href="1">
    text
  </a>
  <span>
    <a href="2">test</a>
    text
  </span>
  <a href="1">
    text
  </a>
</p>
I'm a bit confused, though, by the fact that the text 'text' within
the span element *isn't* within the second half of the wrapping a
element. I would have expected you to want:
<p>
  text
  <a href="1">
    text
  </a>
  <span>
    <a href="2">test</a>
  </span>
  <a href="1">
    <span>
      text
    </span>
    text
  </a>
</p>
so before I start thinking about the actual XSLT, can you confirm that
the rule is that if an element within an a element contains another a
element, then that element is put at the same level as the containing
a element?
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
  | 
| <- Previous | Index | Next -> | 
|---|---|---|
| [xsl] Unwrapping trees, Norman Walsh | Thread | Re: [xsl] Unwrapping trees, Norman Walsh | 
| Re: [xsl] Unexpected attribute erro, Jeni Tennison | Date | Re: [xsl] •, Greg Martel | 
| Month |