On 21 Jun., 16:43, "szomiz" <szo...@kocha.dostawac.reklamy.przez.net>
wrote:
> <xsl:template match="*">
> * * <xsl
aram name="parPath"/>
> * * <xsl:variable name="locPath" select="concat($parPath,'/',name())"/>
> * * <xsl:value-of select="concat($locPath,'

')"/>
> * * <xsl:apply-templates>
> * * * * <xsl:with-param name="parPath" select="$locPath"/>
> * * </
> </
Well, I don't want to sound too ungrateful but this doesn't really
appeal over the one I managed to put together (with help from your
earlier hint - thanks).
- It's not shorter.
- Its not simpler.
- And its not working...
Beyond the broken (obviously, even to me) closing tags, semicolons
seem to be missing in the newline reference.
In fact, simply replacing my:
<xsl:text>
</xsl:text>
with :
<xsl:text>
</xsl:text>
is enough ( and not only is shorter, it also works
> [node()] = [* or text() or comment() or processing-instrction()]
This I *didn't* know. So in XSLT, * means something less general than
node() ?
I find this less than intuitive, *surprising* is the word.
But the funniest thing is, to spit out a list of all directories
under / in unix, all you need type is :
find / -type d
Now, XML is basically a tree of elements encoded in text form -- and
XSLT is supposed to be the 'native' way to process XML, yet it takes
an 8-line template (embedded inside a four-line wrapper to make it a
script) to do this simple task.
(Actually I don't mind the number of lines so much as the fact that it
just looks greek compared to "list all element xpaths".)
Am I the only one who suspects there is something rotten in the land
of XSLT ?
(Am I going to get flamed for heretical talk ?
Anyway, I'd be interested if anyone can put together a 'better' xslt
version than below ?
(Better includes 'shorter', 'easier to understand', but not 'really
cool AND really cryptic'..).
fazl@ubuntu:~/bin/xslt$ cat szomiz.xsl
<?xml version="1.0"?>
<xsl:transform xmlns

sl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl

utput method="text" />
<xsl:template match="*">
<xsl:for-each select="ancestor-or-self::*">
<xsl:value-of select="concat('/',name())"/>
</xsl:for-each>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:transform>
fazl@ubuntu:~/bin/xslt$ cat Person.xml
<?xml version="1.0" standalone='yes'?>
<Person>
<FirstName>Elvis</FirstName>
<LastName>Presley</LastName>
</Person>
fazl@ubuntu:~/bin/xslt$ xsltproc szomiz.xsl Person.xml
/Person
/Person/FirstName
/Person/LastName
Thanks, Fazl