[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Dynamic DTD declaration in output

Subject: Re: Dynamic DTD declaration in output
From: "Paul Tyson phtyson@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 May 2019 03:12:12 -0000
Re:  Dynamic DTD declaration in output
Although I see nothing to recommend it above xsl:result-document in this
case, for the sake of completeness I mention xsl:character-map.

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:param name="doctype-name" select="'doc'"/>
  <xsl:param name="dtd-path" select="'my-document.dtd'"/>
  
  <xsl:character-map name="markup">
    <xsl:output-character character="&#x27E8;" string="&lt;"/>
    <xsl:output-character character="&#x27E9;" string="&gt;"/>
  </xsl:character-map>

  <xsl:output method="xml" indent="yes" use-character-maps="markup"/>

  <xsl:template match="/">
    <xsl:text>&#10;&#x27E8;!DOCTYPE </xsl:text>
    <xsl:value-of select="$doctype-name"/>
    <xsl:text> "</xsl:text>
    <xsl:value-of select="$dtd-path"/>
    <xsl:text>"&#x27E9;&#10;</xsl:text>
    <doc>I'm a document</doc>
  </xsl:template>
  
</xsl:stylesheet>


On Wed, 2019-05-15 at 15:15 +0000, Trevor Nicholls
trevor@xxxxxxxxxxxxxxxxxx wrote:
> Well you learn something every day. I have used result-document in the
> POST-processor stylesheet to split the document apart but I had
> absolutely no idea that - without an href - it could be used to define
> the primary output. It works just the way I needed it to.
> 
>  
> 
> Thank you very much
> 
>  
> 
> cheers
> 
> T
> 
>  
> 
> From: Michael Kay mike@xxxxxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 
> Sent: Wednesday, 15 May 2019 19:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  Dynamic DTD declaration in output
> 
> 
>  
> 
> In XSLT 2.0 you can do:
> 
>  
> 
> 
> <xsl:template match="/">
> 
> 
>   <xsl:result-document doctype-system="{$DefaultDTDPath}" method="xml"
> encoding="utf-8">
> 
> 
>     ....
> 
> 
>   </xsl:result-document>
> 
> 
> </xsl:template>
> 
> 
>  
> 
> 
> Michael Kay
> 
> 
> Saxonica
> 
> 
> 
>         On 15 May 2019, at 06:45, Trevor Nicholls
>         trevor@xxxxxxxxxxxxxxxxxx
>         <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>         
>         
>          
>         
>         Hi
>         
>         
>          
>         
>         
>         I've got a simple stylesheet which is executed as a
>         pre-process when XML documents are loaded into FrameMaker. At
>         the moment the stylesheet includes the line
>         
>         
>          
>         
>         
>             <xsl:output doctype-system="/path/to/docs.dtd"
>         method="xml" encoding="UTF-8" />
>         
>         
>          
>         
>         
>         Because this stylesheet will be used by different users in
>         several different contexts, it would be brilliant if the path
>         to the DTD could be parameterised. I know the following is
>         invalid but the purpose of this post is to ask if there is any
>         way of engineering an equivalent:
>         
>         
>          
>         
>         
>             <xsl:param name="DefaultDTDPath" />
>         
>         
>             <xsl:output doctype-system="{$DefaultDTDPath}"
>         method="xml" encoding="UTF-8" />
>         
>         
>          
>         
>         
>         XSL version has to be 1.0 or 2.0.
>         
>         
>          
>         
>         
>         Thanks
>         
>         
>         T
>         
>         
>          
>         
>         
>                           XSL-List info and archive
>         
>                           EasyUnsubscribe (by email)
>         
>         
>  
> 
> 
>                       XSL-List info and archive 
> 
>                      EasyUnsubscribe (by email) 
> 
> 
>                       XSL-List info and archive 
>                       EasyUnsubscribe (by email)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.