|
Subject: Re: [xsl] Still thinking to object oriented... From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Thu, 9 Oct 2008 10:31:41 +0100 |
ahh ok, if you just want the attributes' names then do:
select="//*[descendant-or-self::*[contains(name(),'to_search')]]/(name(),
@*/name())"
you might prefer to not use a one-liner now, to make it clearer eg:
<xsl:for-each select="//*[descendant-or-self::*[contains(name(),'to_search')]]">
<xsl:value-of select="concat(name(), '&_#xa;')"/>
<xsl:for-each select="@*">
<xsl:value-of select="concat(' ', name(), '&_#xa;')"/>
...
etc
2008/10/9 Jonas Bassl <Jonas@xxxxxxxx>:
> Thank you,
> but i am getting this error:
>
> Cannot mix nodes and atomic values in the result of a path expression
> URL: http://www.w3.org/TR/xpath20/#ERRXPTY0018
>
> Jonas
>
> 2008/10/9 Andrew Welch <andrew.j.welch@xxxxxxxxx>:
>>> now since i was working with the solution i got from here, i am stuck
>>> with the following problem:
>>>
>>> <xsl:template match="/">
>>> <xsl:value-of
>>> select="//*[descendant-or-self::*[contains(name(),'to_search')]]/name()"
>>> separator=" "/>
>>> </xsl:template>
>>> </xsl:stylesheet>
>>>
>>> This stylesheet only gives me the name of the node, but now i have the
>>> requirement to get also attributes from these nodes. Can anyone help
>>> me to change the XPath invocation for my needs. If i try to do it with
>>> the node() function at the end, there are more nodes in the output
>>> than just with the name() function. I know, that has something to do
>>> with empty text nodes and things like that, but i don't know, how to
>>> filter them or which function is appropriate for me to get the same
>>> nodes as the name() function does, but with the attributes.
>>
>>
>> select="//*[descendant-or-self::*[contains(name(),'to_search')]]/(name(), @*)"
>>
>> ....will give you the attributes of the elements as well as its name
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Still thinking to object , Jonas Bassl | Thread | RE: [xsl] Still thinking to object , Michael Kay |
| Re: [xsl] Still thinking to object , Jonas Bassl | Date | Re: [xsl] Still thinking to object , David Carlisle |
| Month |