Sometimes a longer xpath cannot be avoided even if you use templates instead of for-eaches (for example, if you want). This is especially true in XSLT / XPath 2.0:
<xsl:attribute name="tablevel" select="if (following::*[self::topic | self::part]) then (following::*[self::topic | self::part])[1]/@tablevel else @tablevel"/>
I try not to break the "simple" path into lines, but to break the "larger" path into operators or conventions.
For editing, I use Oxygen (which is cross-platform), and it does pretty well with this type of distance. Sometimes it does not predict what you want for sure, but it will maintain the space as soon as it is there, even if you re-release your code.
James sulak
source share