Используйте стандартную функцию XSLT document()
.
Пример:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:value-of select=
"document('http://www.w3.org/2007/schema-for-xslt20.xsd')
/*/xs:annotation[1]/xs:documentation
"/>
</xsl:template>
</xsl:stylesheet>
Когда это преобразование применяется на любом документе XML (не используется), он обращается документ XML по указанному URL-адресу (это XSD для языка XSLT 2.0) и выводит строковое значение первого элемента xs:annotation/xs:documentation
этого удаленного документа XML:
This is a schema for XSLT 2.0 stylesheets.
It defines all the elements that appear in the XSLT namespace; it also
provides hooks that allow the inclusion of user-defined literal result elements,
extension instructions, and top-level data elements.
The schema is derived (with kind permission) from a schema for XSLT 1.0 stylesheets
produced by Asir S Vedamuthu of WebMethods Inc.
This schema is available for use under the conditions of the W3C Software License
published at http://www.w3.org/Consortium/Legal/copyright-software-19980720
The schema is organized as follows:
PART A: definitions of complex types and model groups used as the basis
for element definitions
PART B: definitions of individual XSLT elements
PART C: definitions for literal result elements
PART D: definitions of simple types used in attribute definitions
This schema does not attempt to define all the constraints that apply to a valid
XSLT 2.0 stylesheet module. It is the intention that all valid stylesheet modules
should conform to this schema; however, the schema is non-normative and in the event
of any conflict, the text of the Recommendation takes precedence.
This schema does not implement the special rules that apply when a stylesheet
has sections that use forwards-compatible-mode. In this mode, setting version="3.0"
allows elements from the XSLT namespace to be used that are not defined in XSLT 2.0.
Simplified stylesheets (those with a literal result element as the outermost element)
will validate against this schema only if validation starts in lax mode.
This version is dated 2007-03-16
Authors: Michael H Kay, Saxonica Limited
Jeni Tennison, Jeni Tennison Consulting Ltd.
2007-03-15: added xsl:document element
revised xsl:sequence element
see http://www.w3.org/Bugs/Public/show_bug.cgi?id=4237
ли Примечание:
В случае, если XML-документы, которые будут доступны постоянно находиться в локальных файлах, используйте «файл:» схемы, как это:
'file:///c:/temp/myXmlDocument.xml'
Не могли бы вы привести пример вашего ввода xml и желаемого вывода xml? – Istao
Xml input - мои путеводители, каждый из которых - [книга] (http://www.docbook.org/tdg/en/html/book.html). Все они используют файл стилей xsl, который настраивает вывод HTML. Я хотел бы получить некоторую информацию (id/title каждой книги) из таблицы стилей xsl. Для информации я использую плагин docbook maven и включаю файлы, файлы которых соответствуют имени * -guide.xml. – Mohammed