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

Re: handling tags and PIs within a macro

Subject: Re: handling tags and PIs within a macro
From: Nancy Brandt <nancy_brndt@xxxxxxxxx>
Date: Wed, 24 Oct 2007 07:21:26 -0700 (PDT)
Re:  handling tags and PIs within a macro
Thank you for the explanation, dear Abel.

What I still don't understand is why FOP cannot take
the PCDATA of <fid> element and assign it as an ID to
the formalpara. It is absolutely unclear. May be the
source of the problem is the format of xref to the
formalpara?

For example:
<xref linkend="dhcps_lease_ip" xrefstyle="template:%t
on page %p"/>

where %t is the text of the title of the xreffed
formalpara.

Best regards,
Nancy

--- Abel Braaksma <abel.online@xxxxxxxxx> wrote:

> Nancy Brandt wrote:
> >   <formalpara id="{fid}">  --> This part
> >
> > Why is it important to enclose the "id" part in
> curly
> > brackets?
> 
> That's a way to tell the XSLT processor that inside
> the attribute 
> there's a value that should be interpreted as an
> XPath expression. It is 
> called an Attribute Value Template (or AVT for
> short). You can write:
> 
> <formalpara>
>     <xsl:attribute name="id"><xsl:value-of
> select="fid" /></xsl:attribute>
> </
> 
> Or you can write:
> 
> <formalpara id="{fid}">
> </
> 
> which is quite shorter and closer to what it will
> eventually look like: 
> an element with the "id" attribute set to whatever
> is in inside the 
> 'fid" node (without curlies, this would be the
> literal "fid" string, 
> instead of the content of <fid>). If you, for
> whatever reason, need an 
> explicit { or } inside an attribute, you need to
> double it:
> 
> <formalpara id="{{doublecurlies}}">
> </
> 
> You can use any valid XPath expression. It's result
> will be the 
> string-value of that expression (equal to when you
> would use the 
> xsl:value-of approach instead). Now you may wonder
> why there's still the 
> verbose construct with xsl:attribute, if this is so
> much clearer with an 
> AVT. Well, the short answer is: there are situations
> where an AVT does 
> not suffice. I.e., when you want the name of the
> attribute to be 
> dynamically generated, then, inside the
> xsl:attribute, the @name 
> attribute itself is also an AVT:
> 
> <formalpara>
>     <xsl:attribute name="{attrName}"><xsl:value-of
> select="fid" 
> /></xsl:attribute>
> </
> 
> will create a formalpara element with an attribute
> with the name of 
> whatever is inside the attrName element. If the
> source looked like 
> <attrName>my-jolly-attribute</attrName><fid>Fidelity
> Content</fid> then 
> the output would be
> 
> <formalpara my-jolly-attribute="Fidelity Content">
> </
> 
> 
> HTH,
> Cheers,
> -- Abel Braaksma
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.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.