Здравствуйте. Помогите пожалуйста. Не могу решить проблему с ссылками в xslt.
Есть xml файл на букву А A.xml в нем есть анкор Апельсин по нему переходит на слово апельсин то есть анкоры работают в этом файле нормально при нажатии на ссылку киви в файле A.xml открывается 2 файл К.xml в котором переходит на слово киви, в этом же файле есть ссылка на слово абрикос в файле A.xml. При нажатии на ссылку абрикос в файле K.xml переход на слово абрикос в файле А.xml не осуществляется.
Как сделать так чтобы переходило на слово то есть чтобы Xslt различал где анкоры, а где другие ссылки не анкоры и нормально работал с буквой А в других файлах?
A.xml:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type='text/xsl' href='style.xsl'?>
<Slovar>
<Bukva>A</Bukva>
<Statya>
<Desc>Апельсин</Desc>
<Define>Фрукт</Define>
<Ssilka>банан</Ssilka>
<Ssilka>киви</Ssilka>
</Statya>
<Statya>
<Desc>Абрикос</Desc>
<Define>Фрукт</Define>
<Ssilka>апельсин</Ssilka>
<Ssilka>мандарин</Ssilka>
</Statya>
</Slovar>
K.xml:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type='text/xsl' href='style.xsl'?>
<Slovar>
<Bukva>К</Bukva>
<Statya>
<Desc>Киви</Desc>
<Define>Фрукт</Define>
<Ssilka>абрикос</Ssilka>
<Ssilka>персик</Ssilka>
</Statya>
</Slovar>
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.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<xsl:template match="/Slovar">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="navigation">
<a href="A.xml"> А </a>
<a href="Б.xml"> Б </a>
<a href="К.xml"> К </a>
<a href="М.xml"> М </a>
<a href="П.xml"> П </a>
</div>
<div id="hk"></div>
<div class="header">
<a name="begin" id="begin" />
<p> Список слов на букву <xsl:value-of select="Bukva" /> </p>
</div>
<div id="hj"></div>
<div class="main">
<ul type="square" style="font-size:16pt; font-weight:bolder; padding-left:50pt; padding-top:15pt;float:left;">
<xsl:for-each select="Statya[Des]">
<xsl:variable name="i" select="position()" />
<xsl:variable name="x">
<xsl:value-of select="/Slovar/Statya[position()=$i]/Desc" />
</xsl:variable>
<xsl:call-template name="for">
<xsl:with-param name="i" />
<xsl:with-param name="n" />
</xsl:call-template>
<li> <a href="#{$x}">
<xsl:value-of select="Desc" />
</a>
</li>
</xsl:for-each>
</ul>
</div>
<div id="ka"></div>
<div class="stat">
<xsl:for-each select="Statya">
<xsl:variable name="i" select="position()" />
<xsl:variable name="m">
<xsl:value-of select="/Slovar/Statya[position()=$i]/Desc" />
</xsl:variable>
<table width="100%" border="5" bordercolor="#0000FF" cellspacing="4" cellpadding="4">
<tr>
<td colspan="2" align="center">
<div align="left" class="стиль1">
<a name="{$m}">
<xsl:call-template name="for">
<xsl:with-param name="i" />
<xsl:with-param name="n" />
</xsl:call-template>
<xsl:value-of select="/Slovar/Statya[position()=$i]/Desc" />
</a>
</div>
</td>
</tr>
<td colspan="2">
<ul type="disc">
<li>Расшифровка</li>
<p>
<xsl:value-of select="/Slovar/Statya[position()=$i]/Define" />
</p>
</ul>
</td>
<tr>
<td width="65%" height="43">
<ul type="disc">
<li>Ссылки</li>
<ul type="circle">
<xsl:for-each select="Ssilka">
<xsl:variable name="j" select="position()" />
<li>
<u>
<xsl:variable name="ref2">
<xsl:value-of select="substring(normalize-space(.),1,1)" />
</xsl:variable>
<xsl:variable name="ref55">
<xsl:value-of select="substring(normalize-space(.),1,50)" />
</xsl:variable>
<xsl:variable name="ref3">
<xsl:choose>
<xsl:when test="starts-with($ref55,'А')">
#<xsl:value-of select="substring(normalize-space(.),1,50)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring(normalize-space(.),1,1)" />.xml#<xsl:value-of select="substring(normalize-space(.),1,50)" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="fort">
<xsl:with-param name="j" />
<xsl:with-param name="n" />
</xsl:call-template>
<a href="{$ref3}">
<xsl:value-of select="/Slovar/Statya[position()=$i]/Ssilka[position()=$j]" />
</a>
</u>
</li>
</xsl:for-each>
</ul>
</ul>
</td>
<td colspan="2" width="35%" align="right" valign="middle" style="padding-right:10px"><p>Картинка</p></td>
</tr>
<tr>
<td colspan="2" align="center">
<div align="center">
<p>
<a href="#begin">
ВЕРНУТЬСЯ
</a>
</p>
</div>
</td>
</tr>
</table>
</xsl:for-each>
</div>
</body>
</html>
</xsl:template>
<xsl:template name="for">
<xsl:param name="i" select="position()"/>
<xsl:param name="n" />
<xsl:if test="$i < $n">
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i+1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="fort">
<xsl:param name="j" select="position()"/>
<xsl:param name="n" />
<xsl:if test="$j < $n">
<xsl:call-template name="fort">
<xsl:with-param name="j" select="$j+1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>