powered by simpleCommunicator - 2.0.51     © 2025 Programmizd 02
Форумы / XML, XSL, XPath, XQuery [игнор отключен] [закрыт для гостей] / 2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
17 сообщений из 17, страница 1 из 1
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37231784
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
господа и дамы, помогите , пожалуйста.
как это сделать.
спасибо большое.
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37231813
Фотография _Vasilisk_
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
К каждому документу нужно написать XSL для его отображения
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37231819
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
спасибо _Vasilisk_,

создано:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="file:///F:/2/first.xsl"?>
<first>
<item>
<sort>sort1</sort>
<country>RU</country>
<firm>qqqqq</firm>
</item>
<item>
<sort>sort2</sort>
<country>UA</country>
<firm>123</firm>
</item>
<item>
<sort>sort3</sort>
<country>BY</country>
<firm>dddd</firm>
</item>
<item>
<sort>sort4</sort>
<country>LT</country>
<firm>ffff</firm>
</item>
</first>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fo=" http://www.w3.org/1999/XSL/Format" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:fn=" http://www.w3.org/2005/xpath-functions">

<xsl:template match="first">
<html>
<head> <title> Р’uilding materials </title> </head>
<body>
<table border="1" cellspacing="0" cellpadding="3">
<tr> <th>Sort</th> <th>Country</th> <th>Firm</th> </tr>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>

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

<xsl:template match="sort | country">
<td>
<xsl:apply-templates />
</td>
</xsl:template>

<xsl:template match="firm">
<td>
<a>
<xsl:attribute name="href">second.xml?firm=<xsl:apply-templates/></xsl:attribute>
<xsl:apply-templates/>
</a>

</td>
</xsl:template>

<xsl:template match="text()"> <xsl:value-of select="." />
</xsl:template>

</xsl:stylesheet>

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="file:///F:/2/second.xsl"?>
<second>
<item>
<firm>qqqqq</firm>
<inner>inner</inner>
<price>12.12</price>

</item>
<item>
<firm>123</firm>
<inner>outer</inner>
<price>66.12</price>
</item>
<item>
<firm>dddd</firm>
<inner>inner</inner>
<price>15.12</price>
</item>
<item>
<firm>ffff</firm>
<inner>outer</inner>
<price>56.12</price>
</item>
</second>

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fo=" http://www.w3.org/1999/XSL/Format" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:fn=" http://www.w3.org/2005/xpath-functions">

<xsl:variable name="varFirm">
<xsl:call-template name="show_detail">
<xsl:with-param name="firm" />
</xsl:call-template>
</xsl:variable>

<xsl:template name="show_detail" match="/">
<xsl:param name="firm" />
<xsl:for-each select="second/item">
<p>Firm: <xsl:value-of select="$firm" /></p>
</xsl:for-each>
</xsl:template>

<xsl:template match="second">
<html>
<head> <title> Р’uilding materials details </title> </head>
<body>
<table border="1" cellspacing="0" cellpadding="3">
<tr> <th>Firm</th> <th>Inner/Outer</th> <th>Price</th> </tr>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>

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

<xsl:template match="firm | inner | price">
<td>
<xsl:apply-templates />
</td>
</xsl:template>

<xsl:template match="text()"> <xsl:value-of select="." />
</xsl:template>

</xsl:stylesheet>


непонятно как связать по ссылке. спасибо
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232078
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
пожалуйста выручайте программисты, плиз
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232176
refreg
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
tanship,

В чем все-таки проблема? в 2х документах, сведении в таблицу, или в ссылке?
Что в конечном итоге должно быть? Один html, два html? Если 2 html, почему второй html не html? Кто должен XML превращать в HTML, браузер или сервер? Ну, и ссылка, как запрос к серверу... браузер, (насколько я знаю - могу ошибаться), так не умеет...

PS. Насчет 2-х документов, самый частый ответ - использовать функцию document()
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232202
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
refreg,

дело в том, что в названии темы все условие задачи.
как понимаю - должно быть два html.
смущает что надо через ссылку.
про сервер речи не идет. как понимаю все на стороне клиента.
проблема в ссылке.
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232227
refreg
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
tanshipдело в том, что в названии темы все условие задачи. Это курсовая? XML даны?
tanshipкак понимаю - должно быть два html.Почему второй html не является html?
tanshipсмущает что надо через ссылку.
про сервер речи не идет. как понимаю все на стороне клиента.
проблема в ссылке.html обязательно формировать браузером, заранее наштамповать нужные нельзя?
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232273
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
refreg,
это лаба
дано:
Строительные материалы: вид, страна, фирма / внутренние работы, наружные работы, каталог цен.

то что сделано.
first.xml
<?xml version="1.0" encoding="UTF-8"?>
<first>
<item>
<sort>sort1</sort>
<country>RU</country>
<firm>qqqqq</firm>
</item>
<item>
<sort>sort2</sort>
<country>UA</country>
<firm>123</firm>
</item>
<item>
<sort>sort3</sort>
<country>BY</country>
<firm>dddd</firm>
</item>
<item>
<sort>sort4</sort>
<country>LT</country>
<firm>ffff</firm>
</item>
</first>

second.xml
<?xml version="1.0" encoding="UTF-8"?>
<second>
<item>
<firm>qqqqq</firm>
<inner>inner</inner>
<price>12.12</price>

</item>
<item>
<firm>123</firm>
<inner>outer</inner>
<price>66.12</price>
</item>
<item>
<firm>dddd</firm>
<inner>inner</inner>
<price>15.12</price>
</item>
<item>
<firm>ffff</firm>
<inner>outer</inner>
<price>56.12</price>
</item>
</second>

надо срочно сделать, не понимаю, полная каша.
не понимаю как связать по ссылке(
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232282
refreg
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
tanship,

Как вариант, из второго xml сделать в html таблицу с якорями - и ссылки по якорям:
Код: plaintext
<a href="second.xml#qqqqq">qqqqq</a>
Так работать будет и формально "соединяются при помощи ссылки". При желании можно связать в обе стороны
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232299
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
refreg,

плиз поясни

"Как вариант, из второго xml сделать в html таблицу с якорями - и ссылки по якорям:"

сделано:
first.xslt
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fo=" http://www.w3.org/1999/XSL/Format" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:fn=" http://www.w3.org/2005/xpath-functions">

<xsl:template match="first">
<html>
<head> <title> Вuilding materials </title> </head>
<body>
<table border="1" cellspacing="0" cellpadding="3">
<tr> <th>Sort</th> <th>Country</th> <th>Firm</th> </tr>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>

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

<xsl:template match="sort | country">
<td>
<xsl:apply-templates />
</td>
</xsl:template>

<xsl:template match="firm">
<td>
<a>
<xsl:attribute name="href">second.xml#fr=<xsl:apply-templates/></xsl:attribute>
<xsl:apply-templates/>
</a>



</td>
</xsl:template>

<xsl:template match="text()"> <xsl:value-of select="." />
</xsl:template>

</xsl:stylesheet>

и

second.xlst
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fo=" http://www.w3.org/1999/XSL/Format" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:fn=" http://www.w3.org/2005/xpath-functions">

<xsl:param name="fr"/>

<xsl:template match="/">
<html>
<head>
<title>second</title>
</head>
<body>
<a>
<xsl:attribute name="href">first.xml</xsl:attribute>
return to the first page
</a>
<table border="1">
<tr> <th>firm</th> <th>inner/outer</th> <th>price</th> </tr>
<xsl:for-each select="second/item[firm=$fr]">
<tr>
<td> <xsl:value-of select="firm"/> </td>
<td> <xsl:value-of select="inner"/> </td>
<td> <xsl:value-of select="price"/> </td>
</tr>
</xsl:for-each>
</table>

</body>
</html>

</xsl:template>
</xsl:stylesheet>

не передает параметр,
пожалуйста выручайте
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232343
refreg
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
tanship,

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
<xsl:for-each select="second/item">
	<tr>
		<td>
			<a name="fr={firm/text()}"/>
			<xsl:value-of select="firm"/>
		</td>
		<td>
			<xsl:value-of select="inner"/>
		</td>
		<td>
			<xsl:value-of select="price"/>
		</td>
	</tr>
</xsl:for-each>
Во второй html выводится все значения, просто позиционируется на нужном. Для визуального эффекта надо побольше строк.
PS. "fr=" не нужно - можно убрать в обоих xsl
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232352
refreg
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Кстати, убрать ненужные можно скриптом, но это уже другая история другой форум.
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232365
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
refreg,


спасибо большое,

но не выходит не понимаю куда вставлять(
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232373
refreg
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
tanship,

ну, это совсем плохо...

<tr> <th>firm</th> <th>inner/outer</th> <th>price</th> </tr>
<xsl:for-each select="second/item[firm=$fr]">
<tr>
<td> <xsl:value-of select="firm"/> </td>
<td> <xsl:value-of select="inner"/> </td>
<td> <xsl:value-of select="price"/> </td>
</tr>
</xsl:for-each>
</table>
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232400
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
refreg,

подскажи что не так пожалуйста

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="first.xsl"?>
<first>
<item>
<sort>sort1</sort>
<country>RU</country>
<firm>qqqqq</firm>
</item>
<item>
<sort>sort2</sort>
<country>UA</country>
<firm>123</firm>
</item>
<item>
<sort>sort3</sort>
<country>BY</country>
<firm>dddd</firm>
</item>
<item>
<sort>sort4</sort>
<country>LT</country>
<firm>ffff</firm>
</item>
</first>

.----
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fo=" http://www.w3.org/1999/XSL/Format" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:fn=" http://www.w3.org/2005/xpath-functions">

<xsl:template match="first">
<html>
<head> <title> Р’uilding materials </title> </head>
<body>
<table border="1" cellspacing="0" cellpadding="3">
<tr> <th>Sort</th> <th>Country</th> <th>Firm</th> </tr>
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>

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

<xsl:template match="sort | country">
<td>
<xsl:apply-templates />
</td>
</xsl:template>

<xsl:template match="firm">
<td>
<a>
<xsl:attribute name="href">second.xml#fr=<xsl:apply-templates/></xsl:attribute>
<xsl:apply-templates/>
</a>


</td>
</xsl:template>

<xsl:template match="text()"> <xsl:value-of select="." />
</xsl:template>

</xsl:stylesheet>
-------
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="second.xsl"?>
<second>
<item>
<firm>qqqqq</firm>
<inner>inner</inner>
<price>12.12</price>

</item>
<item>
<firm>123</firm>
<inner>outer</inner>
<price>66.12</price>
</item>
<item>
<firm>dddd</firm>
<inner>inner</inner>
<price>15.12</price>
</item>
<item>
<firm>ffff</firm>
<inner>outer</inner>
<price>56.12</price>
</item>
</second>

-----
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" xmlns:fo=" http://www.w3.org/1999/XSL/Format" xmlns:xs=" http://www.w3.org/2001/XMLSchema" xmlns:fn=" http://www.w3.org/2005/xpath-functions">

<xsl:param name="fr"/>

<xsl:template match="/">
<html>
<head>
<title>second</title>
</head>
<body>
<a>
<xsl:attribute name="href">first.xml</xsl:attribute>
return to the first page
</a>
<table border="1">
<tr> <th>firm</th> <th>inner/outer</th> <th>price</th> </tr>

<xsl:for-each select="second/item">
<tr>
<td>
<a name="fr={firm/text()}"/>
<xsl:value-of select="firm"/>
</td>
<td>
<xsl:value-of select="inner"/>
</td>
<td>
<xsl:value-of select="price"/>
</td>
</tr>
</xsl:for-each>

</table>

</body>
</html>

</xsl:template>
</xsl:stylesheet>

спасибо большон
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232435
refreg
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
refregВо второй html выводится все значения, просто позиционируется на нужном. Для визуального эффекта надо побольше строк.Или в чем-то другом проблема?
...
Рейтинг: 0 / 0
2 XML-документа. Данные свести в таблицы. Документы соединяются при помощи ссылки.
    #37232448
tanship
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
refreg,

спасибо за идеи.

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


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