[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Finding paths in Visio XML exports - recursion qu
At 2008-09-27 20:20 +0100, Steven Davies wrote:
Now, I can use an XPath expression to find the first node in the document easily enough (it has a certain property in its data set to "1") and the only way I've been able to find all connected shapes from this one is to use 3 for-each loops: the first over all <Connect>s beginning at the shape itself, the second nested loop over all other endpoints of the <Connect> (there will only ever be one) and the third over all <Shape>s connected to the <Connect>: Note that "./" as the first step of a location path doesn't do anything ... so where you have (for example) select="./@FromSheet" you need only have select="@FromSheet". That is also why "[@ID=./@ToSheet]" is equivalent to "[@ID=@ToSheet]" which is why it isn't working for you. You want "[@ID=current()/@ToSheet]" because in XSLT current() returns what the current node was when you started the XPath address. The current() function is not part of XPath but can be used with XPath in XSLT. Inside the innermost xsl:for-each I recursively call the template which works very well for a straight flow in Visio. However, there can be infinite loops in the flow so I have to first test whether the <Shape> has already been output before recursing. This works. If you've stopped when your recursion loops back, how is it you are getting multiple levels of recursion? Does anyone have an idea how to get around this? A functioning mocked-up data example would help so that you could illustrate what is working and what isn't working. For myself I'm having problems understanding the prose description. I hope the above helps with part of your problem. . . . . . . . . . . Ken -- Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01 Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|