[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XPath problem

Subject: XPath problem
From: "Jonny Pony" <jonnypony666@xxxxxxxxxxx>
Date: Wed, 28 Apr 2004 09:22:18 +0000
160 xsl
Hi,

I still have a small problem with my modified "Pretty XML Tree Viewer (by Mike J. Brown and Jeni Tennison)

I stripped down the tree-view.xsl to a minimum.

My problem:

I get this as an output:

 tree
  |
  |___DB
      |
      |___Nina
            |
            |___Servus
            |     |
            |     |___Chip
            |
            |___Hallo
                  |
                  |___Warum
                  |     |
                  |     |___Serve
                  |
                  |___PC


But I want the tree starting from an other node; e.g. the node <nina>.


     tree
      |___Nina
            |
            |___Servus
            |     |
            |     |___Chip
            |
            |___Hallo
                  |
                  |___Warum
                  |     |
                  |     |___Serve
                  |
                  |___PC



tree-view.xml

<?xml version="1.0" encoding="utf-8"?>
<DB>
   <Nina>
       <Servus>
           <Chip/>
       </Servus>
       <Hallo>
           <Warum>
               <Serve/>
           </Warum>
           <PC/>
       </Hallo>
   </Nina>
</DB>


My stripped down tree-view.xsl:


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="no"/>
<xsl:template match="/">
<html>
<head>
<title>tree-view by Mike J. Brown and Jeni Tennison</title>
</head>
<body>
<h3>Can't find the solution for my problem</h3>
<xsl:apply-templates select="." mode="render"/>
</body>
</html>
</xsl:template>
<xsl:template match="/" mode="render">
tree
<br/>
<xsl:apply-templates mode="render"/>
</xsl:template>
<xsl:template match="*" mode="render">
<xsl:call-template name="ascii-art-hierarchy"/>
<br/>
<xsl:call-template name="ascii-art-hierarchy"/>___&#160;<xsl:value-of select="local-name()"/>
<br/>
<xsl:apply-templates mode="render"/>
</xsl:template>
<xsl:template name="ascii-art-hierarchy">
<xsl:for-each select="ancestor::*">
<xsl:choose>
<xsl:when test="following-sibling::node()">&#160;&#160;|&#160;&#160;&#160;</xsl:when>
<xsl:otherwise>&#160;&#160;&#160;&#160;&#160;&#160;</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:choose>
<xsl:when test="parent::node() and ../child::node()">&#160;&#160;|</xsl:when>
<xsl:otherwise>&#160;&#160;&#160;</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>



I couldn' solve the problem myself.


Anyone got an idea?

Thanks
Jonny

_________________________________________________________________
MSN Messenger - sehen, welche Freunde online sind! http://www.msn.de/messenger Jetzt kostenlos downloaden und mitmachen!


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.