Hello,
 
we were facing similar issues in the past. 
 
Choosing between several typesetting styles:
Some time ago there was a post dealing with choosing from several stylesheets 
before the conversion itself starts. Suggested command is as follows (it is an 
slighty altered excerpt from our customized xslMenu.incl, this command also 
enables you to dynamically pick profiling values which are then passed to 
DocBook stylesheets - thanks to Hussein - which really makes things easier):
 
<command name="db5.toPS4">
    <process>
      <mkdir dir="resources"/>
 
      <mkdir dir="raw"/>
 
      <copyDocument to="__doc.xml">
        <!-- =================================================================
             Support for DocBook 5 imagedata/svg:svg, imagedata/mml:math
             and *equation/mml:math.
        ================================================================= -->
 
        <extract toDir="resources" xpath="//db5:imagedata/svg:svg">
          <attribute name="fileref" value="{$url}"/>
        </extract>
 
        <extract toDir="resources" xpath="//db5:imagedata/mml:math">
          <attribute name="fileref" value="{$url}"/>
        </extract>
 
        <resources match="(https|http|ftp)://.*"/>
 
        <!-- Support for textdata/@fileref.
             add your favorite text file extensions here: -->
 
        <resources copyTo="."
                   
match=".+\.(txt|text|htm|html|xml|h|c|cpp|java|js|tcl|py|pl|rb)"/>
 
        <!-- referenceAs=absolute_URL is used as a workaround for 
             FOP 0.20.5 ``really strange'' image managment. 
      (This is harmless for XEP.) -->
 
        <resources copyTo="resources"
                   match="(?:.+/)?(.+)\.(png|jpg|jpeg|gif|mml|svg|svgz%1)"
                   referenceAs="%w/resources/$1.$2"/>
 
        <resources copyTo="raw" match="(?:.+/)?(.+)\.tex"
                   referenceAs="%w/resources/$1.%0"/>
 
        <resources copyTo="raw" match="(?:.+/)?(.+)\.(\w+)"
                   referenceAs="%w/resources/$1.png"/>
 
        <resources copyTo="resources" match="(?:.+/)?(.+)"
                   referenceAs="%w/resources/$1"/>
      </copyDocument>
 
      <convertImage format="%0 png" from="raw" to="resources"/>
 
      <mkdir dir="images/callouts"/>
 
      <copyProcessResources resources="xxe-config:docbook5/xsl/images/draft.png"
                            to="images"/>
 
      <copyProcessResources 
resources="@xxe-config:docbook5/xsl/images/callouts/png_callouts.list"
                            to="images/callouts"/>
 
      <transform 
documentation="http://docbook.sourceforge.net/release/xsl/current/doc/fo/%{parameter.name|paper.type}.html"
                 file="__doc.xml" label="Convert to PDF, PostScript"
                 stylesheet="../xsl/fo/pdf.xsl" to="__doc.fo">
        <parameter name="use.extensions">1</parameter>
 
        <!-- Cannot work and generates a lot of error messages. -->
 
        <parameter name="paper.type">A4</parameter>
 
        <parameter name="profile.condition">%1</parameter>
 
        <parameterGroup name="db5.toPS.transformParameters"/>
      </transform>
 
      <processFO file="__doc.fo" processor="XEP" to="__doc.%0">
        <parameter name="OUTPUT_FORMAT">%0</parameter>
 
        <parameter name="PS.LANGUAGE_LEVEL">2</parameter>
 
        <parameterGroup name="db5.toPS4.XEPParameters"/>
 
        <!-- If XEP plug-in has not been installed, try FOP plug-in. -->
 
        <processFO file="__doc.fo" processor="FOP" to="__doc.%0">
          <parameter name="renderer">%0</parameter>
 
          <parameter name="strict-validation">false</parameter>
 
          <parameterGroup name="db5.toPS4.FOPParameters"/>
        </processFO>
      </processFO>
    </process>
  </command>
 
  <command name="db5.toPS4File">
    <process>
      <subProcess name="db5.toPS4" parameter="&quot;%0&quot; &quot;%1&quot;"/>
 
      <upload base="%2">
        <copyFile file="__doc.%0" to="%2"/>
      </upload>
    </process>
  </command>
  
  <command name="docb.chooseStylesheet1">
   <macro>
     <sequence>
       <command name="pick"
                parameter="Choose stylesheet' true
                           'Praha 1 (Stylesheet one)'
                           '../xsl/fo/pdf1.xsl'
         'Stylesheet 2'
                           '../xsl/fo/pdf2.xsl'
         " />
 
       <get expression="sys:setProperty('db5.toPS4.transform', '%c/%_')"
            xmlns:sys="java:java.lang.System"/>
     </sequence>
   </macro>
 </command>
 
 
  <command name="db5.convertToPS4">
    <macro>
      <sequence>
  <command name="docb.chooseStylesheet1" />
        <command name="selectConvertedFile"
                 parameter="saveFileURLWithExtension=%0"/>
 
        <set expression="%_" plainString="true" variable="selectedFile"/>
 
        <command name="prompt" parameter="'Profiling' 'Parameter:'"/>
 
        <get expression="concat('&quot;', '%_', '&quot; &quot;',                
                  $selectedFile, '&quot;')"/>
 
        <command name="db5.toPS4File" parameter="&quot;%0&quot; %_"/>
      </sequence>
    </macro>
  </command>
 
Note the command docb.chooseStylesheet1 which is invoked after you click on the 
particular transform item in the DocBook menu. This command offers you to 
choose from a few stylesheets (which you have to set up here). After that the 
conversion continues in common manner. Path to stylesheets is relative to the 
placement of the xslMenu.incl file.
 
To your other questions - I guess that it is not a bad idea to create as many 
convert document submenus as needed and use them for particular output types - 
we did the same and I think it solved all our requiremenents.
 
Hope this helps.
 
Best regards,
 
Pavel ?kop?k
 
 
 
 


<http://www.aipsafe.cz/> 
-----Original Message-----
From: xmleditor-support-bounces at xmlmind.com 
[mailto:[email protected]] On Behalf Of Philippe Nobili
Sent: Wednesday, April 15, 2009 11:16 AM
To: xmleditor-support at xmlmind.com
Subject: Re: [XXE] Customizing the xslMenu.incl




                --> Why dynamically switch configurations? You'll have very 
hard times
                convincing us that this is really needed.
                  

        (note: This is not the need itself , just a possible solution to meet 
the need)
        
        The need is to be able to choose between several typsetting (XSLT 
stylesheets) styles when converting the document to PDF or HTML (our main 
targets). Typesetting styles depend on the audience (most of it is achieved 
using profiling) and on the publishing  constraints (sometime forced to add 
specific banners, or fonts, or etc etc).
        
        Suggestion [a] does not work for us since the typesetting is not linked 
to the document itself but to the publishing/conversion process (the same 
document can be published according different styles).
        
        So we shall see what we can do by reimplementing the conversion 
procedures in xslMenu.incl instead; something similar to suggestion [b].
        
        Thanks fro you replies anyway,
        Best regards.
        

                You could:
                
                [a] Use the role attribute (or any other such ``semantic-less
                attribute'') of the root element of your documents to 
automatically
                select a variant of the DocBook 4 configuration. See the 
"detect"
                configuration element:
                
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/detect.html
                
                [b] OR Add several "Convert Document" sub-menus to the 
"DocBook" menu,
                each one being adapted to a certain use case.
                
                
                
                
                
                
                  


        -- 
         

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20090416/dbfe53be/attachment-0001.htm
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 1565 bytes
Desc: logoCGGVeritas.jpg
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20090416/dbfe53be/attachment-0001.jpeg
 

Reply via email to