Гость
Форумы / XML, XSL, XPath, XQuery [игнор отключен] [закрыт для гостей] / Организовать работу ссылок xsl / 1 сообщений из 1, страница 1 из 1
03.03.2014, 15:14
    #38576929
allukard
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Организовать работу ссылок xsl
Здравствуйте. Нужно организовать работу ссылок. Внешняя работает, а вот внутренняя не работает.
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
<article>
  <title>Test</title>

  <section>
    <title id="chapter-first">First</title>

    <para>Some text...</para>
  </section>

  <section>
    <title>Second</title>

    <para>Some text...</para>
  </section>

  <section>
    <title>Link elements</title>

      <section>
        <title>Internal links</title>

        <para>Element name: <code>link</code>.</para>       

        <para>Example:</para>

        <para>Please click <link linkend="chapter-first">here</link> to
        go to the Introduction chapter.</para>

        <para>Links without a correct target set, like <link
        linkend="incorrect-target">this</link>, should be highlighted but
        shouldn't take the reader to another place.</para>
      </section>

      <section>
        <title>External links</title>
        
        <para>Example:</para>

        <para>Please click <ulink
        url="http://www.google.com">here</ulink> </para>
      </section>
    </section>
</article>



ну xsl-файл
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
<xsl:stylesheet version = '1.0' 
     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match="title"> 
 <h1 align="center">
  <xsl:value-of select="."/>
 </h1>
</xsl:template>

<xsl:template match="section">
 <xsl:apply-templates/> 
</xsl:template>

<xsl:template match="section/title">
 <H2>
  <xsl:value-of select="."/>
 </H2>
</xsl:template>

<xsl:template match="@*|node()">
 <xsl:copy>
  <xsl:apply-templates select="@*|node()"/>
 </xsl:copy>
</xsl:template>

<xsl:template match="para">
 <xsl:apply-templates select="@*|node()"/>
</xsl:template>

<xsl:template match="link">
 <u style="color:Yellow">
  <a href="#{@linkend}"> <xsl:value-of select="."/>
  </a>
 </u>
</xsl:template>

<xsl:template match="ulink">
 <u style="color:Green">
  <a>
   <xsl:attribute name="href">
   <xsl:value-of select="@url" />
   </xsl:attribute>
   <xsl:value-of select="." />
  </a>
 </u> 
</xsl:template>

</xsl:stylesheet>


Как сделать? Сравнивать со значением id?
...
Рейтинг: 0 / 0
Форумы / XML, XSL, XPath, XQuery [игнор отключен] [закрыт для гостей] / Организовать работу ссылок xsl / 1 сообщений из 1, страница 1 из 1
Целевая тема:
Создать новую тему:
Автор:
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]