ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Use of XML Catalog with Ant (xslt task) - request for example
Date Sat, 17 Aug 2013 12:31:39 GMT
you wont need to write anything...Im just showing you the parameters you would need to create

a working test harness

if you could approach the situation as if someone gave you  a C++ program to write

step1...is to start simple..
get 1 test running

step 2

bring in Collection classes later on (with iterators) and feed a hardcoded set of classes

step 3

finally bring in the folder name and iterate thru all of the files in the supplied folder
name

The only problem I had with this task was changing one of the DTDs from system to public

but you should not have to touch any of the DTDs at least not yet

to reiterate start simple 

infile="test.xsl"

output"test.html"

 

Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni
et de confidentialité


 
Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse
azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett.
 Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs.
 Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség
nem terhelhet ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.

  


> From: richard.kerry@atos.net
> To: user@ant.apache.org
> Subject: RE: Use of XML Catalog with Ant (xslt task) - request for example
> Date: Fri, 16 Aug 2013 16:41:20 +0000
> 
> Goodness, I wasn't anticipating needing to write code to get this sorted ....
> 
> 
> 
> But, as a C++ programmer, Java looks quite familiar. However, I have no experience of
developing in it.
> 
> If this is the way I need to go please can someone point me at some information on how
to get started in order to use the code given here.
> 
> 
> 
> 
> 
> Hopefully,
> 
> Richard.
> 
> 
> 
> 
> 
> Richard Kerry
> BNCS Engineer, SI SOL Telco & Media Vertical Practice
> T: +44 (0)20 82259063
> M: +44 (0)7812 325518
> G300, Stadium House, Wood Lane, London, W12 7TA
> richard.kerry@atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>
> 
> This e-mail and the documents attached are confidential and intended solely for the addressee;
it may also be privileged. If you receive this e-mail in error, please notify the sender immediately
and destroy it. As its integrity cannot be secured on the Internet, the Atos group liability
cannot be triggered for the message content. Although the sender endeavours to maintain a
computer virus-free network, the sender does not warrant that this transmission is virus-free
and will not be liable for any damages resulting from any virus transmitte
> ________________________________
> From: Martin Gainty [mgainty@hotmail.com]
> Sent: 16 August 2013 13:39
> To: Ant Users List
> Subject: RE: Use of XML Catalog with Ant (xslt task) - request for example
> 
> Richard
> 
> the best way to handle this is to turn on full debugging ..here are the parameters you
will want to supply to the <xslt> taskdef
> 
> /** destination directory */
> private File destDir = null;
> 
> /** where to find the source XML file, default is the project's basedir */
> private File baseDir = null;
> 
> /** XSL stylesheet as a filename */
> private String xslFile = null;
> 
> /** XSL stylesheet as a {@link org.apache.tools.ant.types.Resource} */
> private Resource xslResource = null;
> 
> /** extension of the files produced by XSL processing */
> private String targetExtension = ".html";
> 
> /** name for XSL parameter containing the filename */
> private String fileNameParameter = null;
> 
> /** name for XSL parameter containing the file directory */
> private String fileDirParameter = null;
> 
> /** additional parameters to be passed to the stylesheets */
> private Vector params = new Vector();
> 
> /** Input XML document to be used */
> private File inFile = null;
> 
> /** Output file */
> private File outFile = null;
> 
> /** The name of the XSL processor to use */
> private String processor;
> 
> /** Classpath to use when trying to load the XSL processor */
> private Path classpath = null;
> 
> /** The Liason implementation to use to communicate with the XSL
> * processor */
> private XSLTLiaison liaison;
> 
> /** Flag which indicates if the stylesheet has been loaded into
> * the processor */
> private boolean stylesheetLoaded = false;
> 
> /** force output of target files even if they already exist */
> private boolean force = false;
> 
> /** XSL output properties to be used */
> private Vector outputProperties = new Vector();
> 
> /** for resolving entities such as dtds
> BTW steer clear of DTDs they are cumbersome and have been replaced by XSDs 5 years ago*/
> private XMLCatalog xmlCatalog = new XMLCatalog();
> 
> /** Utilities used for file operations */
> private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
> 
> /**
> * Whether to style all files in the included directories as well.
> * @since Ant 1.5
> */
> private boolean performDirectoryScan = true;
> 
> /**
> * factory element for TraX processors only
> * @since Ant 1.6
> */
> private Factory factory = null;
> /**
> * whether to reuse Transformer if transforming multiple files.
> * @since 1.5.2
> */
> private boolean reuseLoadedStylesheet = true;
> 
> /**
> * AntClassLoader for the nested &lt;classpath&gt; - if set.
> * <p>We keep this here in order to reset the context classloader
> * in execute. We can't use liaison.getClass().getClassLoader()
> * since the actual liaison class may have been loaded by a loader
> * higher up (system classloader, for example).</p>
> *
> * (when the ant runtime looks for classes they should be specified here)
> * @since Ant 1.6.2
> */
> private AntClassLoader loader = null;
> 
> /**
> * Mapper to use when a set of files gets processed.
> * @since Ant 1.6.2
> */
> private Mapper mapperElement = null;
> 
> /**
> * Additional resource collections to process.
> * @since Ant 1.7
> */
> private Union resources = new Union();
> 
> /**
> * Whether to use the implicit fileset.
> * @since Ant 1.7
> */
> private boolean useImplicitFileset = true;
> 
> /**
> * The default processor is trax
> * @since Ant 1.7
> */
> public static final String PROCESSOR_TRAX = "trax";
> 
> /**
> * whether to suppress warnings.
> * NEVER set to true when debugging
> * @since Ant 1.8.0
> */
> private boolean suppressWarnings = false;
> 
> /**
> * whether to fail the build if an error occurs during transformation.
> * @since Ant 1.8.0
> */
> private boolean failOnTransformationError = true;
> 
> /**
> * whether to fail the build if an error occurs.
> * @since Ant 1.8.0
> */
> private boolean failOnError = true;
> 
> /**
> * Whether the build should fail if the nested resource collection
> * is empty.
> * I don't like this dependence on resources being populated you may want to consider
setting this to false
> * @since Ant 1.8.0
> */
> private boolean failOnNoResources = true;
> 
> /**
> * System properties to set during transformation.
> * @since Ant 1.8.0
> */
> private CommandlineJava.SysProperties sysProperties =
> new CommandlineJava.SysProperties();
> 
> /**
> * Trace configuration for Xalan2.
> * @since Ant 1.8.0
> */
> private TraceConfiguration traceConfiguration;
> 
> org.apache.tools.ant.taskdefs.XSLTProcess
> 
> give it a go and send us the build.xml and your classpath
> as well as all entries you have in your catalog BUT
> I would start with something dirt simple like infile and outfile
> once the infile xslt is transformed to outfile.html
> THEN you can get test with catalogs and or other forms of collections
> 
> HTH
> Martin Gainty
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> 
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so
bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer
Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und
entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails
koennen wir keine Haftung fuer den Inhalt uebernehmen.
> 
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.
> 
> 
> > From: richard.kerry@atos.net
> > To: user@ant.apache.org
> > Subject: RE: Use of XML Catalog with Ant (xslt task) - request for example
> > Date: Fri, 16 Aug 2013 09:34:37 +0000
> >
> >
> >
> > I don't think this covers my use cases, in particular :
> >
> >
> >
> > 1. External catalog file (Catalog.xml).
> >
> > 2. Use of the catalog to find the xsl file for the transform (ie the "style" attribute
or sub-element of <xslt>).
> >
> >
> >
> > Does anyone have an example using these ?
> >
> >
> >
> >
> >
> > 1. I've developed the catalog while doing other processing using Saxon, which is
accessed using a Java task. In that case Saxon takes parameters indicating where to find the
catalog file (more accurately the folder containing catalogManager.properties, which points
to the Catalog.xml).
> >
> > The documentation for Ant's Xslt task indicates that this is possible but there
are no examples there and nothing I've tried so far has managed to make it work.
> >
> > The example submitted here contains the catalog contents in a <xmlcatalog>
element, not a reference to a catalog file.
> >
> >
> >
> > 2. The example submitted here doesn't appear to use a catalog to get the style file
- there is no mention of "xml/doc.xsl" in the <xmlcatalog> shown.
> >
> >
> >
> > 3. The Ant documentation implies resolver.jar needs to be in the system classpath,
but I can't see where this should be set. As far as I can tell I haven't got one - the <xslt>
does have a <classpath> child but that doesn't seem to do it.
> >
> >
> >
> > I hope someone can clarify all this.
> >
> >
> >
> > Regards,
> >
> > Richard.
> >
> >
> >
> > Richard Kerry
> > BNCS Engineer
> > T: +44 (0)20 82259063[X]<thismessage:/Body.htm#>
> > M: +44 (0)7812 325518[X]<thismessage:/Body.htm#>
> > Room EBX 301, BBC Television Centre, Wood Lane, London, W12 7RJ
> > richard.kerry@atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=mailto%3arichard.kerry%40atos.net>
> > uk.atos.net<https://webmail.siemens-it-solutions.com/owa/redir.aspx?C=9fb20d019e3e4cb99344d708709a3177&URL=http%3a%2f%2fuk.atos.net%2fen-uk%2f>
> > This e-mail and the documents attached are confidential and intended solely for
the addressee; it may also be privileged. If you receive this e-mail in error, please notify
the sender immediately and destroy it. As its integrity cannot be secured on the Internet,
the Atos group liability cannot be triggered for the message content. Although the sender
endeavours to maintain a computer virus-free network, the sender does not warrant that this
transmission is virus-free and will not be liable
> > ________________________________
> > From: Jan Matèrne (jhm) [apache@materne.de]
> > Sent: 14 August 2013 20:56
> > To: 'Ant Users List'
> > Subject: AW: Use of XML Catalog with Ant (xslt task) - request for example
> >
> > From Ants test directory:
> >
> >
> >
> > snippet from the buildfile
> >
> > <xmlcatalog id="xdocs.catalog">
> >
> > <dtd publicID="-//stevo//DTD doc 1.0//EN"
> >
> > location="xml/doc.dtd"/>
> >
> > </xmlcatalog>
> >
> >
> >
> > <target name="testCatalog" depends="init">
> >
> > <xslt destdir="xml/out"
> >
> > includes="xml/about.xml"
> >
> > extension=".txt"
> >
> > style="xml/doc.xsl">
> >
> > <xmlcatalog refid="xdocs.catalog"/>
> >
> > </xslt>
> >
> > <concat><fileset dir="xml/out" includes="**"/></concat>
> >
> > </target>
> >
> >
> >
> >
> >
> > xsl
> >
> >
> >
> > <xsl:stylesheet
> >
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
> > version="1.0">
> >
> >
> >
> > <xsl:output method="text"/>
> >
> >
> >
> > <xsl:template match="/">
> >
> > <xsl:value-of select="/doc/section"/>
> >
> > </xsl:template>
> >
> >
> >
> > </xsl:stylesheet>
> >
> >
> >
> >
> >
> > xml
> >
> >
> >
> > <!DOCTYPE doc PUBLIC
> >
> > "-//stevo//DTD doc 1.0//EN"
> >
> > "http://chemical/brothers"
> >
> > >
> >
> > <doc>
> >
> > <section title="About">
> >
> > in the absence of technology, there is only marketing
> >
> > </section>
> >
> > </doc>
> >
> >
> >
> >
> >
> >
> >
> > Jan
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Von: Kerry, Richard [mailto:richard.kerry@atos.net]
> > Gesendet: Mittwoch, 14. August 2013 17:03
> > An: user@ant.apache.org
> > Betreff: Use of XML Catalog with Ant (xslt task) - request for example
> >
> >
> >
> >
> >
> > I’m trying to get DocBook WebHelp building working, which uses Ant to
> > control the various processes involved, in particular Xslt.
> >
> > I would like to use Catalogs for resolving my XSL stylesheet locations, and
> > have thus far been unable to make this work.
> >
> >
> >
> > I’ve tried to follow Ant’s documentation regarding the <xmlcatalog> element
> > but I can’t get it to work. (I am finding the Ant documentation in this
> > area extremely hard to follow)
> >
> > By “can’t get it to work” I mean it doesn’t find the files I’m trying
to
> > reference via the catalog. It doesn’t show any messages indicating whether
> > or not it is using the resolver, so I presume it isn’t finding it.
> >
> >
> >
> > Does anyone have any complete example of this working.
> >
> > Ie one that includes a reference to the resolver jar, and the classpath, and
> > the catalog file and/or catalogManager.properties.
> >
> >
> >
> >
> >
> > Appreciatively,
> >
> > Richard.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Richard Kerry
> >
> > BNCS Engineer, SI SOL Telco & Media Vertical Practice
> >
> >
> >
> > T: +44 (0)20 822 59063[X]<thismessage:/Body.htm#>
> >
> > M: +44 (0)7812 325518[X]<thismessage:/Body.htm#>
> >
> > Lync: +44 (0) 20 3618[X]<thismessage:/Body.htm#> XXXX
> >
> > Room G300, Stadium House, Wood Lane, London, W12 7TA
> >
> > <mailto:richard.kerry@atos.net> richard.kerry@atos.net
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message