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

Re: Repeating Code

Subject: Re: Repeating Code
From: Nicholas Orr <nick@xxxxxxxxxxx>
Date: Mon, 10 Oct 2005 07:57:41 +1000
xml repeating code
On 08/10/2005, at 4:17 PM, Ragulf Pickaxe wrote:

It sounds to me like you do not know the mechanics of XSLT.



Well that's probably part of the problem (it's new to me, but I'm learning), but also I don't think I explained it well enough. My xslt file contains :

<xsl:for-each select="/FMPReport/File/descendant::Chunk [@type='FieldRef']">
<xsl:call-template name="EXPORTDATA"/>
</xsl:for-each>



and then later on :


    <xsl:template name="EXPORTDATA">
                <ROW>
                    <xsl:attribute name="MODID">0</xsl:attribute>
                    <xsl:attribute name="RECORDID">0</xsl:attribute>
                    <COL>
                        <DATA>
                            <xsl:value-of select="./@type"/>
                        </DATA>
                    </COL>
                    <COL>
                        <DATA>
                            <xsl:value-of select="./Field/@id"/>
                        </DATA>
                    </COL>
...
                </ROW>
    </xsl:template>

So essentially it's going through each of the FieldRef's in the XML and generating a <ROW> with a whole bunch of <COL> data. The selects that I've got take into account a whole raft of either parent nodes, child nodes and ancestor nodes as well. So any solution has to be flexible in that sense.

What I was thinking it would be neat to do (from my filemaker programming perspective was have some way of having all of the lists of xsl:value-of in one place,

                            <xsl:value-of select="./@type"/>
                            <xsl:value-of select="./Field/@id"/>
...

and then

                    <COL>
                        <DATA>
                            <repeat here>
                        </DATA>
                    </COL>

in one place as well. That way I'm not only reducing the lines of code, but also separating the output XML from the xsl.

Have I made more sense this time. This is using XALAN, so it's all xsl 1.0 too.

Thanks,
Nick

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.