|
Subject: Re: [xsl] REtrieving attributes with XPATH From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 10 Sep 2003 17:34:45 -0400 |
<xsl:template match="article">
<xsl:copy>
<xsl:apply-templates select="@articleid|@width|@height"/>
</xsl:copy>
</xsl:template><xsl:template match="@articleid">
<id>
<xsl:value-of select="."/>
</id>
</xsl:template><xsl:template match="@width|@height">
<xsl:element name="{local-name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>The XPath "@articleid|@width|@height" is short for "attribute::articleid | attribute::width | attribute::height"
Enjoy, Wendell
Hi,
imagine that i have this XML,
<article articleid="1" height="5" rating="2" sectionid="1" width="6" xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/daeDocuments" src:key="1"><title>Corrupção ambiental</title><text>ilegaisddfdf</text></article>
<article articleid="2" height="4" rating="2" sectionid="1" width="7" xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/daeDocuments" src:key="1"><title>Corrupção ambiental</title><text>ilegaisddfdf</text></article>
and i want to retreive something like this
<article> <id>1</id> <width>6</width> <height>5</height> </article>
<article> <id>2</id> <width>7</width> <height>4</height> </article>
how can i do it in XSL?
====================================================================== 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 -> |
|---|---|---|
| [xsl] REtrieving attributes with XP, Miguel Carvalho | Thread | [xsl] how to pass parameters down t, SANWAL, ABHISHEK (HP |
| [xsl] referencing to other xml and , Manolis Mavrikis | Date | Re: [xsl] how to pass parameters do, Wendell Piez |
| Month |