[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] filtering descendent text nodes
Subject: RE: [xsl] filtering descendent text nodes From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Tue, 19 Mar 2002 08:51:20 -0000 |
> That was very informative. Thanks. I have a set of > tags of which some are whitespace text nodes. We'll be talking at cross-purposes unless you use the correct terminology. A tag is either a start tag like <p> or an end tag like </p> (or an empty element tag like <br/>). A tag is not a node, and it is certainly not a text node. I need > to filter out nodes which are not whitespace text > nodes (to be more contedtual i need to know how many > nodes has meaningful data associated and how many are > whitespace text nodes). Is there any way of doing > this. Please find below an example situation in the > context of my query. > <Employee> > <empid>eid100</empid> > <proj-id>pid1</proj-id> > </Employee> > <Employee> > <empid>eid101</empid> > <proj-id></proj-id> > </Employee> > <Employee> > <empid>eid102</empid> > <proj-id>pid2</proj-id> > </Employee> I think you are interested in the element <proj-id></proj-id>. This element does not contain a whitespace text node; it contains no text node at all. You can select all the Employees that have a <proj-id>, where the value of the proj-id is the empty string, using the expression //Employee[proj-id=''] > > From the above list how can i filter out employees who > doesnt have a project id assigned. If i try the > strip-space tag how do i compare for the occurance of > null. > There's no such thing as null in the XPath data model, so I don't know exactly what you mean. xsl:strip-space causes the removal of text nodes containing only whitespace characters, for example the text node between the <empid> element and the <proj-id> element. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] filtering descendent text, Aseef Jamaluddin | Thread | Re: [xsl] filtering descendent text, Peter Davis |
RE: [xsl] Comparing previous, Michael Kay | Date | [xsl] parent and .., Matts Isuls |
Month |
Keywords