[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Hot to get names ??
Hi Khalid, the following should solve your problem: <xsl:template match="product"> <xsl:apply-templates select="*[starts-with(name(), 'udt')]"/> </xsl:template> You need exactly the same for <edition> and it should work. If you want to test for <last-modified> and <start-date> too, you have to add more filters: <xsl:apply-templates select="*[following-sibling::start-date][preceding-sibling::last-modified][s tarts-with(name(), 'udt')]"/> Regards, Joerg > Hello All, > How do I get the names of each element and then do some processing accordingly,I > can't seem to find a way to use name() appropriately,any help is appreciated, > > below is the chunk of xml that I am using,I want to be able to get all the > elements which are after last-modified and before start-date,so I would like > to get some condition that checks for the elements names that begin with 'udt',but > there are other elements attached to this element and the have the same structure,and > what I want is only get the values at each level from between the last-modified > and start-date. > > <product> > <system-id>4</system-id> > <last-modified>22 January, 2002 09:26</last-modified> > <udt-product-id>DMD</udt-product-id> > <udt-product-name>Daily Mail Monday to Friday</udt-product-name> > <start-date>7 January, 2002</start-date> > <end-date /> > <publishing-frequency>Weekly</publishing-frequency> > <editions> > <edition> > <system-id>71</system-id> > <last-modified>22 January, 2002 09:21</last-modified> > <udt-product-code>DMD</udt-product-code> > <udt-edition-name>Anglia1</udt-edition-name> > <udt-print-centre-code>HQP</udt-print-centre-code> > <udt-descriptor>Edition</udt-descriptor> > <start-date>8 January, 2002</start-date> > <end-date /> > > </editions> > </produict> > </products> > in the above example the tree contains multiple subroot elements that has the > same structure as product.I need to get only the elements which start with udt > at each level.,say first I would like to get all the elements that start-with > 'udt' from the product level,at this point I do not want to get any element > which may appear at lower level of heirarchy such as editions.I would only want > edition related values on descretion. > please guide,thanks XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|