[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: how to match node set with attribute then pass toa

Subject: Re: how to match node set with attribute then pass toatemplate
From: Biying Huang <biying@xxxxxxxxxxxxxxx>
Date: Mon, 29 Sep 2003 15:46:26 -0400
biying huang
Professor Holman:

Thank you very much. It works perfectly for me.

By the way, I am new to XSLT, and not quite understand things like:

<xsl:if test="count( preceding-sibling::Attachment[@showImage='true'] ) mod 2
= 0">
and
<xsl:for-each
         select="following-sibling::Attachment[@showImage='true'][1]">
.......

Which of your books should I read first?

Biying

"G. Ken Holman" wrote:

> At 2003-09-26 15:52 -0400, Biying Huang wrote:
> >So I have to put <fo:table-row>.
>
> A revision is below ... act on every second one and then address the one
> following.
>
> >In my case, for each Attachment, how can I
> >output its <info> on top of its <filename>,
>
> To put the info on top of its filename, put each in separate blocks.
>
> I hope this helps.
>
> .................. Ken
>
> T:\Biying>type biying.xml
> <AttachmentList>
>      <Attachment showImage="true">
>          <filename>Image5445.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>
>    <Attachment showImage="false">
>          <filename>Image5446.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>
>    <Attachment showImage="true">
>          <filename>Image5447.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>    <Attachment showImage="false">
>          <filename>Image5448.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>
>    <Attachment showImage="true">
>          <filename>Image5449.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>    <Attachment showImage="false">
>          <filename>Image5450.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>
>    <Attachment showImage="true">
>          <filename>Image5451.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>
>    <Attachment showImage="true">
>          <filename>Image5452.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>    <Attachment showImage="false">
>          <filename>Image5453.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>
>    <Attachment showImage="true">
>          <filename>Image5454.jpg</filename>
>          <info>image information</info>
>    </Attachment>
>
> </AttachmentList>
>
> T:\Biying>type biying.xsl
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                  xmlns="http://www.w3.org/1999/XSL/Format"
>                  version="1.0">
>
> <xsl:output indent="yes"/>
>
> <xsl:template match="/">
> <root font-family="Times" font-size="20pt">
>
>    <layout-master-set>
>      <simple-page-master master-name="frame"
>                          page-height="210mm" page-width="297mm"
>                          margin-top="1cm" margin-bottom="1cm"
>                          margin-left="1cm" margin-right="1cm">
>        <region-body region-name="frame-body"/>
>      </simple-page-master>
>    </layout-master-set>
>
>    <page-sequence master-reference="frame">
>      <flow flow-name="frame-body">
>        <block>Test of table columns</block>
>        <table border="solid">
>          <table-body>
>            <xsl:apply-templates select="/AttachmentList/
>                                         Attachment[@showImage='true']"/>
>          </table-body>
>        </table>
>      </flow>
>    </page-sequence>
> </root>
> </xsl:template>
>
> <xsl:template match="Attachment">
>    <xsl:if test="count( preceding-sibling::Attachment[@showImage='true'] )
>                  mod 2 = 0">
>      <table-row>
>        <table-cell border="solid">
>          <block><xsl:value-of select="info"/></block>
>          <block><xsl:value-of select="filename"/></block>
>        </table-cell>
>        <xsl:for-each
>          select="following-sibling::Attachment[@showImage='true'][1]">
>          <table-cell border="solid">
>            <block><xsl:value-of select="info"/></block>
>            <block><xsl:value-of select="filename"/></block>
>          </table-cell>
>        </xsl:for-each>
>      </table-row>
>    </xsl:if>
> </xsl:template>
>
> </xsl:stylesheet>
> T:\Biying>saxon -o biying.fo biying.xml biying.xsl
>
> T:\Biying>type biying.fo
> <?xml version="1.0" encoding="utf-8"?>
> <root xmlns="http://www.w3.org/1999/XSL/Format" font-family="Times"
> font-size="20pt">
>     <layout-master-set>
>        <simple-page-master master-name="frame" page-height="210mm"
> page-width="297mm" margin-top="1cm" margin-bottom="1cm" margin-left="1cm"
> margin-right="1cm">
>           <region-body region-name="frame-body"/>
>        </simple-page-master>
>     </layout-master-set>
>     <page-sequence master-reference="frame">
>        <flow flow-name="frame-body">
>           <block>Test of table columns</block>
>           <table border="solid">
>              <table-body>
>                 <table-row>
>                    <table-cell border="solid">
>                       <block>image information</block>
>                       <block>Image5445.jpg</block>
>                    </table-cell>
>                    <table-cell border="solid">
>                       <block>image information</block>
>                       <block>Image5447.jpg</block>
>                    </table-cell>
>                 </table-row>
>                 <table-row>
>                    <table-cell border="solid">
>                       <block>image information</block>
>                       <block>Image5449.jpg</block>
>                    </table-cell>
>                    <table-cell border="solid">
>                       <block>image information</block>
>                       <block>Image5451.jpg</block>
>                    </table-cell>
>                 </table-row>
>                 <table-row>
>                    <table-cell border="solid">
>                       <block>image information</block>
>                       <block>Image5452.jpg</block>
>                    </table-cell>
>                    <table-cell border="solid">
>                       <block>image information</block>
>                       <block>Image5454.jpg</block>
>                    </table-cell>
>                 </table-row>
>              </table-body>
>           </table>
>        </flow>
>     </page-sequence>
> </root>
>
> --
> Next public US delivery:        3-day XSLT/2-day XSL-FO 2003-10-13
> Next public European delivery:  3-day XSLT/2-day XSL-FO 2003-11-??
> Instructor-led on-site corporate, government & user group training
> for XSLT and XSL-FO world-wide:  please contact us for the details
>
> G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
> Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
> Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
> ISBN 0-13-065196-6                       Definitive XSLT and XPath
> ISBN 0-13-140374-5                               Definitive XSL-FO
> ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
> ISBN 1-894049-11-X               Practical Formatting Using XSL-FO
> Member of the XML Guild of Practitioners:     http://XMLGuild.info
> Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.