Subject: RE: [xsl] identifying elements by contents of an attribute From: Jarno.Elovirta@xxxxxxxxx Date: Fri, 28 Mar 2003 10:04:37 +0200 |
Hi, > I believe this is very easy, but I just can't figure out how to do it. > I need to identify elements according to the value of a > specific attribute. > > The XML document looks like this: > > <?xml version="1.0" encoding="ISO-8859-1"?> > <INPUT> > > <VERSION Type="Key"> 1.0 </VERSION> > > <HEADER Type="Block"> > <DATE Type="Key"> 06.03.2003 </DATE> > <USER Type="Key"> D. Brauer </USER> > </HEADER> > > </INPUT> > > For different values of the attribute "Type" (i.e. "Block", "Key") > differnet templates should be applied. These have to access > the name and > contents of the matched element respectively. > Can anybody give me a hint on this? <http://www.w3.org/TR/xslt> and <http://www.w3.org/TR/xpath> most probably can. Anyhow, I didn't quite get what you were after, but just write templates with predicates <xsl:template match="*[@Type = 'Key']"> <xsl:value-of select="name()" />: <xsl:value-of select="." /> ... <xsl:template match="*[@Type = 'Block']"> <xsl:apply-templates select="*" /> ... An so forth. Cheers, Jarno - Skinny Puppy: VX Gas Attack XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Questions about page-numb, PIERRES | Thread | AW: [xsl] identifying elements by c, Daniel Brauer |
[xsl] identifying elements by conte, Daniel Brauer | Date | Re: [xsl] empty element as an end-m, Dimitre Novatchev |
Month |