xsl-list
[Top] [All Lists]

RE: [xsl] defining output document type by stylesheet parameters

2008-02-18 10:44:39
Thanks, Ken.  That works perfectly.  And, I filled in some gaps in my
knowledge of XSLT theory by learning about attribute value templates.

-James 


-----Original Message-----
From: G. Ken Holman [mailto:gkholman(_at_)CraneSoftwrights(_dot_)com] 
Sent: Monday, February 18, 2008 11:29 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] defining output document type by stylesheet
parameters

At 2008-02-18 11:04 -0600, James Sulak wrote:
In XSLT 2.0, is it possible to define the output document type by
stylesheet parameters?

Yes, not with <xsl:output> but with <xsl:result-document> ... most of 
the attributes of <xsl:result-document> are attribute value 
templates, where none of the <xsl:output> ones are.

...
I know this type of thing wasn't possible in 1.0, but it seems like it
might be in 2.0.  Is there another approach I should be using, or am I
out of luck?  I'm using Saxon 9B.

I hope the example below helps.

. . . . . . . . . . Ken

X:\samp>type resultdoc.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 version="2.0">

<xsl:output indent="yes"/>

<xsl:variable name="test">test.ent</xsl:variable>

<xsl:template match="/">
   <xsl:result-document doctype-system="{$test}">
     <hello/>
   </xsl:result-document>
</xsl:template>

</xsl:stylesheet>
X:\samp>xslt2 resultdoc.xsl resultdoc.xsl t:\j.xml

X:\samp>type t:\j.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hello
   SYSTEM "test.ent">
<hello/>
X:\samp>



--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>