|
|
|
Xslt. Ось preceding-sibling::
|
|||
|---|---|---|---|
|
#18+
Доброго время суток. Сижу тут балуюсь (иногда парюсь)с осями. Есть некоторые вопросы. Хотелось бы выслушать мнения знающих людей по этому поводу. К примеру: 1. В чем разница между: Код: plaintext 1. 2. Код: plaintext 2. Почему после оси нельзя написать current() ? или $e равное к примеру тегу 'header'. 3. Можно ли как нить отгородить значения относящиеся к одноименным тегам во время присваения переменной значения. К примеру есть xml: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. Код: plaintext 1. 2. Я понимаю что можно выделить одноименые теги в какой нить один общий, но это приведет к переделованию слишком многих уже сделанных работ. Можно написать условие (xsl:if) которое будет проверять одноименност имен. Но сделать так немогу, потому что данный код формируется другой программой, в ходе преобразования одно файла в другой, и вностить изменения в конечный вариант я права не имею. Пока всё. Буду очень благодарен за толковые ответы ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.04.2007, 11:11 |
|
||
|
Xslt. Ось preceding-sibling::
|
|||
|---|---|---|---|
|
#18+
Набросал тут, вроде это тебе надо ? Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.04.2007, 13:28 |
|
||
|
Xslt. Ось preceding-sibling::
|
|||
|---|---|---|---|
|
#18+
Круто!!!! Огромное спасибо TiG. Это более чем я мог желать по третьему вопросу. А что можно сказать по первым двум? Кто нибудь может это объяснить ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.04.2007, 13:58 |
|
||
|
Xslt. Ось preceding-sibling::
|
|||
|---|---|---|---|
|
#18+
SuSa1. В чем разница между: Код: plaintext 1. 2. Код: plaintext Не знаю, у меня всё ок. Скорее ты что-то не то потом с этой переменной делаешь. А разница в том, что в первом $b содержит текстовое представление узла, а во втором - node set. SuSa2. Почему после оси нельзя написать current() ? или $e равное к примеру тегу 'header'. Если честно, не понял о чём ты :) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.04.2007, 14:13 |
|
||
|
Xslt. Ось preceding-sibling::
|
|||
|---|---|---|---|
|
#18+
TiG SuSa2. Почему после оси нельзя написать current() ? или $e равное к примеру тегу 'header'. Если честно, не понял о чём ты :) Ну в смысле: preceding-sibling::current() или <xsl:variable name="e" select="header'/> <xsl:value-of select="preceding-sibling::$e"/> примерно так ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.04.2007, 14:42 |
|
||
|
Xslt. Ось preceding-sibling::
|
|||
|---|---|---|---|
|
#18+
SuSaНу в смысле: preceding-sibling::current() или <xsl:variable name="e" select="header'/> <xsl:value-of select="preceding-sibling::$e"/> примерно так А что ты хотел таким образом получить ? XPath Reference Location Steps A location step selects a set of nodes (a node-set) relative to the context node. There are three parts to a location step: an optional axis, a node test, and an optional predicate. The syntax for a location step is the axis name followed by a double colon, then the node test, and finally zero or more predicates, each in square brackets. The most basic form of this syntax is as follows: axis::nodetest[predicate] axis Specifies the tree relationship between the context node and the nodes to be selected by the location step. In other words, the axis indicates the general direction that the location step proceeds from the context node. In a location step, the axis is optional. If omitted, the axis defaults to child::. Furthermore, several axes have shortcut forms; for instance, the ampersand (@) character is a shortcut for the attribute axis. nodetest Specifies the node type or expanded name of the nodes to be initially selected by the location step. Basically, the node test indicates which node(s), from among all nodes on the indicated axis, to consider as candidates, that is, potential, matches for the location step. predicate Uses an XPath expression (condition to be met) to further refine the set of nodes selected by the location step. The predicate is a filter, specifying a selection criterion for further refining the list of candidate nodes. The predicate is optional. If there is no predicate, there are no square brackets ([ and ]) in the location step. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.04.2007, 14:55 |
|
||
|
Xslt. Ось preceding-sibling::
|
|||
|---|---|---|---|
|
#18+
SuSapreceding-sibling::current() current() не является фильтром узлов и недопустим в таком контексте. Также ось preceding-sibling не содержит текущего узла. SuSa<xsl:variable name="e" select="header'/> <xsl:value-of select="preceding-sibling::$e"/> примерно таккак фильтровать узлы тебе написали. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.04.2007, 13:35 |
|
||
|
|

start [/forum/topic.php?fid=14&msg=34476000&tid=1334332]: |
0ms |
get settings: |
5ms |
get forum list: |
10ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
28ms |
get topic data: |
6ms |
get forum data: |
1ms |
get page messages: |
32ms |
get tp. blocked users: |
1ms |
| others: | 219ms |
| total: | 306ms |

| 0 / 0 |
