This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: efficient filtering of XML files. ( XML!=content && XSLT!=pr esentation )?


Just trying this idea out, below is an example of seperating
content from presentation.

the xml file contains pure content.
The hdrs.xml file contains the 'labels' for the content
(could be selected based on language)
The xsl file presents the content, pre-pending each required
one with any necessary labelling.

Just for fun :-) good idea Mike B/Dan M

What would make it slightly more terse (and more flexible) would be
to have a named template do the call, calculating the
path to root, which is then inverted by another named template
which is used to access the hdrs.xml file with a 'stupid'
string as default in case you've forgotten to include it.
Now that would be neat ;-)



main xml file
<?xml version="1.0" ?>
<file-list>
  <absolute>file://\f:\sgml\files\file1.xml</absolute>
  <absolute>file://\f:\sgml\files\file2.xml</absolute>
</file-list>

file hdrs.xml

<?xml version="1.0" ?>
<file-list>
   <absolute>File name is: </absolute>
  </file-list>


xsl file

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<xsl:template match="file-list">
  <BODY>
    <xsl:value-of
select="document('../files/hdrs.xml',.)/file-list/absolute"/><xsl:value-of
select="absolute"/>
  </BODY>
</xsl:template>
</xsl:stylesheet>

output

<?xml version="1.0" encoding="utf-8"?>
<BODY>File name is:file://\f:\sgml\files\file1.xml</BODY>


so long as the hdrs file has enough structure to
reflect sufficient seperation, it is simple enough
to isolate appropriate headers.
Now all my fixed text can go into a seperate header
file which can be chosen by the stylesheet.


Nice idea IMHO

Regards DaveP


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]