xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Repeating Code


Subject: Re: [xsl] Repeating Code
From: Nicholas Orr <nick@xxxxxxxxxxx>
Date: Mon, 10 Oct 2005 07:57:41 +1000

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
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor