[xsl] Help with elements nested at different levels

Subject: [xsl] Help with elements nested at different levels
From: Vincenzo Menanno <enzo13@xxxxxxx>
Date: Sun, 30 Dec 2007 14:12:19 -0800
Hi everyone,

Pardon the lack of knowing the right terms and all...

I believe we are using xerces xml parser and we are using XSLT 2.0

Here is a very small collapsed sample of the XML I am dealing with...

<?xml version="1.0" encoding="UTF-16"?>
<FMPReport link="Summary.xml" type="Report" version="9.0v3"
creationDate="12/30/2007" creationTime="3:56:20 AM">
    <File name="sample.fp7" path="/Users/tony/Desktop">

        <ScriptCatalog>
            <Script id="1" name="my script" includeInMenu="True"
runFullAccess="False">
                <StepList>
                    ...
                </StepList>
            </Script>
            <Group id="2" name="New Group" includeInMenu="True"
groupCollapsed="False">
                <Script id="4" name="New Script" includeInMenu="True"
runFullAccess="False">
                    <StepList>
                        ...
                    </StepList>
                </Script>
            </Group>
            <Group id="5" name="sdfsd" includeInMenu="True"
groupCollapsed="False">
                <Group id="7" name="sfdkjhs" includeInMenu="True"
groupCollapsed="False">
                    <Group id="9" name="jdfhgsdf"
includeInMenu="True" groupCollapsed="False">
                        <Script id="17" name="fjsyfjsdfg"
includeInMenu="False" runFullAccess="False">
                            ...
                        </Script>
                        <Script id="18" name="fksjhgfjhsg"
includeInMenu="False" runFullAccess="False">
                            ...
                        </Script>
                        <Script id="19" name="dfgdfkjhg"
includeInMenu="False" runFullAccess="False">
                            <StepList/>
                        </Script>
                    </Group>
                </Group>
            </Group>
            <Script id="11" name="sdfjhg" includeInMenu="True"
runFullAccess="False">
                <StepList/>
            </Script>
            <Script id="12" name="-" includeInMenu="True"
runFullAccess="False">
                <StepList/>
            </Script>
            <Group id="13" name="Hidden" includeInMenu="False"
groupCollapsed="True">
                <Group id="15" name="Hidden 1" includeInMenu="False"
groupCollapsed="True"/>
                <Group id="20" name="Hidden 2" includeInMenu="False"
groupCollapsed="True"/>
            </Group>
        </ScriptCatalog>

        <CustomMenuCatalog>
            <CustomMenu id="1" name="FileMaker Pro Copy">
                <Options findMode="True" browseMode="True"
macPlatform="True"/>
                <BaseMenu name="FileMaker Pro" value="1"/>
                <MenuItemList>
                    <MenuItem macPlatform="True" winPlatform="False">
                        <Command id="57664" name="About FileMaker
Pro"/>
                        <Step id="1" name="Perform Script"
enable="True">
                            <StepText>Perform Script
[ &lt;unknown&gt; ]</StepText>
                            <CurrentScript value="Pause"/>
                            <Script id="0" name="&lt;unknown&gt;"/>
                        </Step>
                    </MenuItem>
                    <MenuItem macPlatform="True" winPlatform="False">
                        <Step id="1" name="Perform Script"
enable="True">
                            <StepText>Perform Script
[ &lt;unknown&gt; ]</StepText>
                            <CurrentScript value="Pause"/>
                            <Script id="0" name="&lt;unknown&gt;"/>
                        </Step>
                    </MenuItem>
                </MenuItemList>
            </CustomMenu>
        </CustomMenuCatalog>

    </File>
</FMPReport>


---------------------------


I have written an xsl file that parses the individual "Script" nodes
in the ScriptCatalog and it works fine.... the problem recently is
that FileMaker has now added the ability that the Script Element I am
looking for in the ScriptCatalog might be nested within a Group or
SubGroup or any other sub nesting ...

Group/Group/Group/Script

Ken already emailed me a suggestion where I could just use //Script to
get all the script elements... but the problem with that is the
CustomMenuCatalog might also have MenuItems with Script elements.

Originally I had this to get me all the script elements...

/FMPReport/File[1]/ScriptCatalog[1]/Script

But that now only gets me to the first Script if it is not within a
group.

This however picks up all the entries inside the CustomMenuCatalog

//Script

Any suggestions on how I can get the complete list of all the Script
entries even if they are nested 1, 2, 3, ...n levels?

Thanks

Vince

Current Thread