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.
精彩评论