Next in thread → Next in month →

Re: [docbook-apps] getting text from external xml file

From
Marie Sauvage - EBM WebSourcing <>
Date
2007-07-31T13:07:58+00:00
ID
Thread
Re: [docbook-apps] getting text from external xml file
Great it works !

I did this in the ant build file to pass the pom file to the fo.xsl (I
manage several projects, my task is dynamic) :

    <property name="pom"
value="${basedir}/../${project.dir}/pom.xml" />

    <xslt basedir="${basedir}" style="${style.file}" 

          in="tmpfile" out="${output}" extension="${extension}">

      <param name="pomfile" expression="${pom}" />

      [...]

Then, in my fo.xsl I add this to create the param :

  <xsl:param name="pomfile"></xsl:param>

and get the version in it as you said :

<xsl:value-of select="document($pomfile)/ms:project/ms:version"/>

thank you very much for your precious help !

Marie.

Dave Pawson a écrit :
Marie
Sauvage - EBM WebSourcing wrote:
  

  To pass it as a parameter would be easy for
me, as I get it in my ant script before to call the generation !
    

How can I pass it as a parameter ?
    

  
  

From the command line,
  

  

saxon inputFile.xml stylesheet.xsl date=2007-07031
  

  

  

  

But can you tell me more about the xpath solution ? or maybe give me a
link to where to find doc about it ?
    

I think it could be better to have it directly in the stylesheet.
    

  
  

With the input file
  

<project xmlns="http://maven.apache.org/POM/4.0.0"
  

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  

    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  

http://maven.apache.org/maven-v4_0_0.xsd">
  

    <modelVersion>4.0.0</modelVersion>
  

  

    <name>My Project</name>
  

    <artifactId>my-project</artifactId>
  

    <groupId>my.group</groupId>
  

    *<version>1.5</version>*
  

  

xmlns:ms="http://maven.apache.org/POM/4.0.0"
  

  

It would be
  

  

<xsl:value-of select="document('x.xml')/ms:project/ms:version"/>
  

if you wanted version
  

or
  

<xsl:value-of
select="document('x.xml')/ms:project/ms:ModelVersion"/>
  

  

to get 4.0.0
  

  

  

  

regards
Next in thread → Next in month →