xsl-list
[Top] [All Lists]

RE: Converting attribute value to XML!

2004-01-23 10:59:35
Thank you, Ken. As you can see, I'm quite new. - Maria

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of G. 
Ken Holman
Sent: January 23, 2004 12:13 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Converting attribute value to XML!


At 2004-01-23 11:30 -0500, Amuchastegui, Maria wrote:
Try this. - Maria
...
<filed>
        <xsl:attribute name="name"><xsl:value-of 
select="@name"/></xsl:attribute>

Maria, when using literal result elements, you can use an attribute value 
template to be more succinct:

   <filed name="{(_at_)name}">

... or you can use the copy-of instruction:

   <filed>
     <xsl:copy-of select="@name"/>

... which is really handy when you want to copy all attributes:

   <xsl:copy-of select="@*"/>

... which you don't want in this particular example.

Remember that you are constructing the result tree and there are four ways 
of adding attribute nodes to the result tree,

  (1) - xsl:use-attribute-sets=
  (2) - attribute specifications in a literal result element
  (3) - <xsl:attribute>
  (4) - <xsl:copy-of>

For the attributes of any given element, the priority is (1), (2), (3 and 4 
in stylesheet order).  The result tree isn't completed for a given set of 
attributes until content is defined for the element in which the attributes 
are used.  As soon as content is defined, the set of attribute nodes cannot 
be changed.

I hope this helps.

................................ Ken


--
Public courses: sign up for one or both soon to reserve your seat!
Each week:  Monday-Wednesday: XSLT/XPath;  Thursday-Friday: XSL-FO
Washington, DC: 2004-03-15           San Francisco, CA: 2004-03-22
Hong Kong, China: 2004-05-17           Bremen, Germany: 2004-05-24
World-wide on-site corporate, government & user group XML training

G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>