shouldn't that first template use position or something? And actually what I
suppose is that there are other p_5f_prototype elements somewhere before the
p_5f_something else, so I guess one would either use modes or pass a variable
all the way along to respresent tree structure. Too busy right now to do it,
but basically to make a complicate open office hierarchy, for example style
names

a,b,c,d,e

into a/b/c/d/e can be a lot of work if it is possible to have sequences like

a,b,a,a,b,c,a,b,c,c,d,b,c,d,e

and what is wanted is a hierarchy like:

<a>
 <b></b>
</a>
<a></a>
<a><b><c></c></b></a>
<a><b><c></c><c><d></d></c></b>
<b><c><d><e></e></d></c></b>
</a>

I've had some experience with doing this kind of thing in OO and often it is
this kind of deep hierarchy people want to transform the flat OO structure
to. 


Cheers,
Bryan Rasmussen





-----Oprindelig meddelelse-----
Fra: Dave Pawson [mailto:[EMAIL PROTECTED]
Sendt: 19. april 2007 08:43
Til: [email protected]
Emne: Re: [xml-dev] Normalizing Multi-Line Tags?


On 18/04/07, Michael B Allen <[EMAIL PROTECTED]> wrote:
> Can someone recommend how I might transform something like the following:
>
> <text:p text:style-name="p_5f_soemthing_else">blah</text:p>
> <text:p text:style-name="p_5f_prototype">session_start();</text:p>
> <text:p text:style-name="p_5f_prototype">require_once('foo.php');</text:p>
> <text:p text:style-name="p_5f_prototype"/>
> <text:p text:style-name="p_5f_prototype">bool some_function(resource
$px,</text:p>
> <text:p text:style-name="p_5f_prototype"><text:s text:c="8"/>string
$ssn_id,</text:p>
> <text:p text:style-name="p_5f_prototype"><text:s text:c="8"/>array
$options=NULL)</text:p>
> <text:p text:style-name="p_5f_soemthing_else">blah</text:p>
> <text:p text:style-name="p_5f_prototype">another proto ...</text:p>
>
> into the this:
>
> <pre>session_start();
> require_once('foo.php');
>
> bool some_function(resource $px,
>         string $ssn_id,
>         array $options=NULL)</pre>
>
> <pre>another proto ...</pre>



<xsl:template match="text:p[text:style-name="p_5f_prototype"]>
<pre>
 <xsl:value-of select="."/>
<xsl:value-of
select="following-sibling::text:[EMAIL PROTECTED]:style-name="p_5f_prototype"]

[preceding-sibling::*[1][self:text:[EMAIL 
PROTECTED]:style-name="p_5f_prototype"]]]
</pre>
</

<xsl:template match="text:p[text:style-name="p_5f_prototype"]
/>

the downside of a flat structure.

HTH


-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to