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

Re: Find the node name of the parent in the result tre

Subject: Re: Find the node name of the parent in the result tree?
From: Brian Chrisman <brchrisman@xxxxxxxxx>
Date: Fri, 22 Mar 2013 16:27:28 -0700
Re:  Find the node name of the parent in the result tre
On Fri, Mar 22, 2013 at 2:14 PM, Martin Holmes <mholmes@xxxxxxx> wrote:
> If I have a template matching an attribute, and producing one in the output
> tree, like this:
>
>   <xsl:template match="@style">
>         <xsl:attribute name="style" select="."/>
>   </xsl:template>
>
> Is there any way to know the name of the element in the result tree which is
> the parent of the attribute being created?
>
> Some context: I'm turning TEI @style attributes into HTML @style attributes
> in the output, and I'd like to handle situations in which this kind of
> input:
>
> <hi rend="text-align: center;">Centred text</hi>
>
> results in output that doesn't work:
>
> <span style="text-align: center;">NOT centred because it's a span</span>
>
> If I knew the output element was a <span> or element which is inline by
> default, I could add "display: block" automatically to any @style attribute
> that contains a block-level CSS property such as text-align. I don't want to
> add "display: block" in all cases, because e.g. a <div> element might
> already have a class which floats it.
>
> Cheers,
> Martin

A two-stage stylesheet pipeline would work, provided that the context
you need is either *all* from the original document or *all* from the
result document (but not pieces/parts from each). (Also provided no
particular resource constraint.)
Might also be stylistically better than munging it all into one
stylesheet, if doing so separates different components of the
presentation.

-Brian

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.