Subject: RE: [xsl] How can I find a particluar element in an XML file? From: "Sunil Dua" <sdua@xxxxxxxxxxxxxxx> Date: Wed, 22 Aug 2001 12:20:07 -0700 |
here is the style file for you <?xml version='1.0' encoding='utf-8' ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/> <xsl:template match="/"> <xsl:for-each select="/table/row/column[@name='personID']"> <PRODUCT> <xsl:apply-templates select="." /> </PRODUCT> </xsl:for-each> </xsl:template> </xsl:stylesheet> -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Sunil Dua Sent: Wednesday, August 22, 2001 12:12 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] How can I find a particluar element in an XML file? try this <xsl:apply-templates select="/table/row/column[@name='personID']/." /> -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Phil Sent: Wednesday, August 22, 2001 9:05 AM To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] How can I find a particluar element in an XML file? I am trying extract a particular data item and so far have been unable to find out how to do it, any help would be much appreciated. Below is an extract of my input XML file : <?xml version="1.0"?> <table name="Industry"> <row command="update"> <column name="Periodical">No</column> <column name="personID">ML101363</column> <column name="PersonNumber">449.0773</column> </row> </table> I want to be able to grab the value of 'personID' (In this case ML101363), my problem is that do not know how to specifically request personID, is there a 'where' clause or something similar I can use? This is how I would like my XML output file to appear. < PRODUCT > <PersonID>ML101363</PersonID> </ PRODUCT > The XSL below simply selects al the columns but how can I request a specific column name. Any help much appreciated. <?xml version='1.0' encoding='utf-8' ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/> <xsl:template match="/"> <PRODUCT> <xsl:apply-templates select="/table/row/column" /> </PRODUCT> </xsl:template> <xsl:template match="column"> <PersonID> <xsl:value-of select="."/> </ PersonID > </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] How can I find a particlu, Sunil Dua | Thread | RE: [xsl] one element and two names, DuCharme, Bob (LNG) |
RE: [xsl] How can I find a particlu, Sunil Dua | Date | [xsl] Removing nodes that have dupl, Phil Servedio |
Month |