Re: [xslt] exslt:document and xsltproc



david reid wrote:
> Suppose I have
> 
>   <xsl:for-each select="item">
>     <xsl:variable name="uri" select="concat('dir/', name, '.xml')"/>
>     <exsl:document method="xml" version="1.0" encoding="utf-8"
> href="{$uri}">
>       <xsl:apply-templates select="."/>
>     </exsl:document>
>   </xsl:for-each>
> 
> What I really want is some way of writing out each exsl:document as a
> seperate file using a filename based on $uri. Is such a thing possible?

Seems to work for me; I also have

...
<xsl:template mode="diagram" match="/td:treedoc/td:nonterminal">
  <xsl:variable name="uri"
   select="concat($output-uri, '/diagram/', @name, '.html')"/>
  ...
  <exsl:document href="{$uri}"
		 method="xml" version="1.0" encoding="utf-8"
                 omit-xml-declaration="no" media-type="text/xhtml"
		 doctype-public="-//W3C//DTD XHTML 1.1//EN"
		 indent="yes">
...

And xsltproc creates a new file for every element the template matches.
Your code should work fine (assuming the template for item creates
a well-formed XML document), if you use @name instead of name for the
concat (assuming your item elements have a name attribute).



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]