OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] XSL - Extracting a list of images


On Tue, Nov 23, 2004 at 07:36:43PM +0000, Phil Weston wrote:

> ie. I have a number of ...<imagedata fileref="myfile1.png"/>... type
> elements spread liberally through my docbook XML and I want to
> produce a list that's like:
>
> myfile1.png
> myfile2.png
> myfile3.png

Use <xsl:output method="text"/> to make a text list, and then you want
two templates: match="imagedata" which prints the value of the
'fileref' attribute, and match="node()|@*" which does nothing but
apply-templates in order to ignore everything else.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

  <xsl:output method="text"/>

  <xsl:template match="imagedata">
    <xsl:value-of select="@fileref"/>
    <xsl:text>&#10;</xsl:text>
  </xsl:template>

  <xsl:template match="node()|@*">
    <xsl:apply-templates/>
  </xsl:template>
</xsl:stylesheet>

&#10; is a linefeed.


-- 
Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/

PGP signature



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]