Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / XML, XSL, XPath, XQuery [игнор отключен] [закрыт для гостей] / xml-(xslt)->xml / 3 сообщений из 3, страница 1 из 1
15.03.2006, 17:39
    #33603237
Критик
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
xml-(xslt)->xml
День добрый, есть ли встроенное усечение строк, отличное от приведенного ниже?
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
	<msxsl:script language="C#" implements-prefix="user">
		<![CDATA[
				public string trim(string s)
				{
					return s.Trim();
				}
		]]>
	</msxsl:script>
...
				<xsl:value-of select="user:trim(HEADER/@IDFILE)" />
...
Рейтинг: 0 / 0
16.03.2006, 10:38
    #33604362
qu-qu
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
xml-(xslt)->xml
КритикДень добрый, есть ли встроенное усечение строк, отличное от приведенного ниже?....

Код: plaintext
1.
2.
....normalize-space("  abc    def  ") 
<!-- Returns the argument string with the leading, trailing, and repeating white spaces stripped -->
MSDN
Example
The following example normalizes a block of text string with unnormalized white spaces (tabs, leading and trailing spaces, and multiple spaces between words. The text string is the value of an <text> element.

XML File (normSpace.xml)

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl"
href="normalizeSpace.xsl"?>
<text>
This is a
test, with a lot of
irregular spacing and
waiting to be normalizaed.


</text>
XSLT File (normSpace.xsl)

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml"
omit-xml-declaration="yes"/>

<xsl:template match="/text">
Unnormalized:
"<xsl:value-of select='.'/>"
Normalized: "<xsl:value-of select='normalize-space()'/>"
</xsl:template>

</xsl:stylesheet>
This XSLT produces the following output:

Unormalized:
"
This is a
test, with a lot of
irregular spacing and
waiting to be normalizaed.


"
Normalized:
"This is a test, with a lot of irregular spacing and waiting to be normalized."
...
Рейтинг: 0 / 0
16.03.2006, 11:15
    #33604548
Критик
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
xml-(xslt)->xml
спасибо
...
Рейтинг: 0 / 0
Форумы / XML, XSL, XPath, XQuery [игнор отключен] [закрыт для гостей] / xml-(xslt)->xml / 3 сообщений из 3, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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