Subject: Re: [xsl] moving an element and then converting it to an attribute From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 16 Aug 2012 11:28:43 -0400 |
in a template for<media> just pull in the value of<image-size> like this:
<xsl:template match="media"> <xsl:copy> <xsl:apply-templates select="@*" /> <xsl:attribute name="image-size" select="normalize-space(..//image-size[1])"/> </xsl:copy> </xsl:template>
This assumes that<media> is an empty element.
As<image-size> is not a sibling of<media> I go to the parent element (..) and search all descendants (//) for<image-size>. In case there are multiple<image-size> present I just use the first instance as otherwise the normalize-space() function would create a run-time error.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] moving an element and the, Michael Müller-Hille | Thread | Re: [xsl] moving an element and the, Michael Müller-Hille |
Re: [xsl] Process following sibling, David Carlisle | Date | Re: [xsl] Process following sibling, Wendell Piez |
Month |