开发者

XSLT - Output contents of a file (embed contents of a .css in generated .html)

开发者 https://www.devze.com 2023-01-07 02:18 出处:网络
is there a way to output the contents of a file in XSLT? Background: I have an xml file as input for a xslt stylesheet and generate an html file, which links to a css. So far so good.

is there a way to output the contents of a file in XSLT? Background: I have an xml file as input for a xslt stylesheet and generate an html file, which links to a css. So far so good.

开发者_开发知识库

Now I want to change my xslt in a way that the contents of the css is embedded within the html file (using a <style> element). However, I would like to keep the xslt and css separated, if possible.

Thanks! Nang.


Yes, this can be done with XSLT 2.0

From http://www.w3.org/TR/xslt20/#unparsed-text

The unparsed-text function reads an external resource (for example, a file) and returns its contents as a string.

The $href argument must be a string in the form of a URI. The URI must contain no fragment identifier, and must identify a resource that can be read as text. If the URI is a relative URI, then it is resolved relative to the base URI from the static context.

0

精彩评论

暂无评论...
验证码 换一张
取 消