RE: [xsl] Processing on both a document list and referenced documents

Subject: RE: [xsl] Processing on both a document list and referenced documents
From: "Bjorndahl, Brad" <brad.bjorndahl@xxxxxxxxxxxxxxxx>
Date: Tue, 11 Mar 2008 18:00:19 -0400
Mark,

I'm still not sure I get all your requirements, but look at this to see if it
handles the files the way you want.

The first 4 templates process your directory file. I use another mode in the
last one because I find that helps me when I start processing in another
'namespace' (to use the term loosely). It's the last one that uses the
regression I mentioned previously.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
xmlns:hdlg="http://www.hdlg.info/XML/filesystem";>
  <xsl:output method="html" indent="yes"/>
  <xsl:template match="/">
    <html>
      <body>
      <xsl:apply-templates />
      </body>
    </html>
  </xsl:template>

  <xsl:template match="hdlg:filesystem" >
    <ul>
      <xsl:apply-templates />
    </ul>
  </xsl:template>

  <xsl:template match="hdlg:folder" >
    <li>
      <xsl:value-of select="@url"/>
      <ul>
        <xsl:apply-templates />
      </ul>
    </li>
  </xsl:template>

  <xsl:template match="hdlg:file" >
    <li>
      <xsl:value-of select="title"/>
      <ul>
        <xsl:apply-templates select="document(@url)" mode="file" />
      </ul>
    </li>
  </xsl:template>

  <xsl:template match="topic" mode="file" >
    <li>
      <xsl:value-of select="title" />
      <xsl:if test="topic" >
        <ul>
          <xsl:apply-templates select="topic" mode="file" />
        </ul>
      </xsl:if>
    </li>
  </xsl:template>

</xsl:stylesheet>

Hoping this helps or at least gives you more options,
Brad

-----Original Message-----
From: Mark Peters [mailto:flickrmeister@xxxxxxxxx]
Sent: March 11, 2008 4:41 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Processing on both a document list and referenced
documents

Hi Brad, everyone,

The sample directory list in my original email organizes folders and file
paths. I'd like my output to pull the folder structure from the directory
list, but apply additional transformations against the files referenced by the
file paths. The output would include these transformations (bulleted lists of
topic titles) organized within the folder structure provided in the directory
list file.

The HTML output I provided organizes the folders and files in a bulleted list.
My XSL transformation produces an HTML bulleted list; but includes the entire
set of topic titles for *all* referenced topic files under each folder list
item.

I hope that explanation made my intent clearer and not more confusing. :-)

Thanks,
Mark


On Tue, Mar 11, 2008 at 2:42 PM, Bjorndahl, Brad
<brad.bjorndahl@xxxxxxxxxxxxxxxx> wrote:
> Hi,
>
>  Is it possible? Yes, I'm sure. I extract all kinds of stuff from DITA and
DITAMAP (= directory list) files.
>  You need to be clearer about "the contents of both the directory list and
the documents referenced by the directory list".
>
>  Also, you have nested multiple "<xsl:for-each select="topic">" statements.
Recursion will probably be more effective.
>
>  Brad
>
>



--

Mark Peters
Senior Technical Writer
Saba Software

Current Thread