Link to home
Start Free TrialLog in
Avatar of alicia1234
alicia1234Flag for United States of America

asked on

Can't figure out why my xslt is not working below a certain node

The XML is listed below in the code field. I am unable to get anything below the <TaxonomyItemHtml> node and I cannot figure out why.

This works (returns the correct data):
<xsl:value-of select="TaxonomyItemQuickLink"/>

This also works (I get everything in the node):
<xsl:copy-of select="TaxonomyItemHtml/node()"/>

But if I try this, I don't get anything:
<xsl:copy-of select="TaxonomyItemHtml/root/node()"/>

And none of these work (return nothing):
<xsl:copy-of select="TaxonomyItemHtml/root/ProgramHeadline/text()" />
<xsl:value-of select="TaxonomyItemHtml/root/VendorName"/>
<xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@src"/>
<xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@alt"/>
<xsl:copy-of select="TaxonomyItemHtml/root/ProgramHeadline/text()" />

I have another XML file that is similarly structured but with different tags, and I have an XSLT file that works just fine on that. It basically has all of the value-of and copy-of structures that I've listed above, but with different tag names.

So what am I missing here? It seems like this should be pretty straight-forward, but I admit that I am fairly new at this.

I will also post the entire XSLT file…



<?xml version="1.0" encoding="utf-8" ?>
<TaxonomyData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <TaxonomyId>104</TaxonomyId>
    <TaxonomyName>Supplies</TaxonomyName>
    <TaxonomyImage></TaxonomyImage>
    <CategoryUrl></CategoryUrl>
    <Visible>true</Visible>
    <TaxonomyType>Content</TaxonomyType>
    <TaxonomyLanguage>1033</TaxonomyLanguage>
    <TaxonomyLanguageName>English (U.S.)</TaxonomyLanguageName>
    <TaxonomyDescription></TaxonomyDescription>
    <TaxonomyParentId>103</TaxonomyParentId>
    <TaxonomyLevel>2</TaxonomyLevel>
    <TaxonomyPath>\Program Categories\Supplies</TaxonomyPath>
    <TaxonomyCreatedDate>2010-12-20T16:47:18.713</TaxonomyCreatedDate>
    <TaxonomyItemCount>2</TaxonomyItemCount>
    <TaxonomyHasChildren>false</TaxonomyHasChildren>
    <TemplateId>0</TemplateId>
    <TemplateName></TemplateName>
    <TemplateInherited>true</TemplateInherited>
    <TemplateInheritedFrom>103</TemplateInheritedFrom>
    <TaxonomyItems>
        <TaxonomyItemData>
            <TaxonomyId>104</TaxonomyId>
            <ContentType></ContentType>
            <TaxonomyItemStatus>Approved</TaxonomyItemStatus>
            <ContentSubType>Content</ContentSubType>
            <TaxonomyLanguage>1033</TaxonomyLanguage>
            <TaxonomyItemId>53</TaxonomyItemId>
            <TaxonomyItemLanguage>1033</TaxonomyItemLanguage>
            <TaxonomyItemType>1</TaxonomyItemType>
            <TaxonomyItemAddedUser>0</TaxonomyItemAddedUser>
            <TaxonomyItemTitle>Discount School Supply</TaxonomyItemTitle>
            <TaxonomyItemTeaser>
                <p>Discount School Supply offers the lowest prices guaranteed on teacher supplies and quality products for early childhood educators, caregivers and parents of young children to support child development. 20% off on all in-stock merchandise. </p>
            </TaxonomyItemTeaser>
            <TaxonomyItemQuickLink>/discount_school_supply.aspx</TaxonomyItemQuickLink>
            <TaxonomyItemEditorLastName>Jane</TaxonomyItemEditorLastName>
            <TaxonomyItemEditorFirstName>Doe</TaxonomyItemEditorFirstName>
            <TaxonomyItemDateModified>12/22/2010 8:07:59 PM</TaxonomyItemDateModified>
            <TaxonomyItemDisplayDateModified>12/22/2010 8:07:59 PM</TaxonomyItemDisplayDateModified>
            <TaxonomyItemDisplayDateCreated>12/20/2010 5:17:33 PM</TaxonomyItemDisplayDateCreated>
            <TaxonomyItemThumbnail></TaxonomyItemThumbnail>
            <TaxonomyItemImage></TaxonomyItemImage>
            <TaxonomyItemHtml>
                <root>
                    <Logo>
                        <img alt="Discount School Suppy" src="/uploadedImages/Content/Core_Programs/discountschoolsupply.jpg" />
                    </Logo>

                    <VendorName>Discount School Supply</VendorName>
                    <ProgramHeadline>Discounts on School Supplies Everyday!</ProgramHeadline>
                    <ProgramSummary>A summary would be here</ProgramSummary>
                    <ProgramDetails>
                        <p>A bunch of detail stuff would be here</p>
                        <p>A bunch of detail stuff would be here</p>
                        <p>A bunch of detail stuff would be here</p>
                    </ProgramDetails>
                    <ContactName></ContactName>
                    <ContactEmail></ContactEmail>
                    <ContactPhone>555.555.1234</ContactPhone>
                    <ContactFax></ContactFax>
                    <WebsiteURL>
                        <a title="Discount School Supply" href="http://www.discountschoolsupply.com" target="_blank">www.discountschoolsupply.com</a>
                    </WebsiteURL>
                </root>
            </TaxonomyItemHtml>
            <TaxonomyItemObjectType>0</TaxonomyItemObjectType>
            <TaxonomyItemFilePath>discount_school_supply.aspx</TaxonomyItemFilePath>
            <TaxonomyItemFolderId>76</TaxonomyItemFolderId>
            <TaxonomyItemGoLiveDate>0001-01-01T00:00:00</TaxonomyItemGoLiveDate>
            <TaxonomyItemEndDate>0001-01-01T00:00:00</TaxonomyItemEndDate>
        </TaxonomyItemData>
        <TaxonomyItemData>
            <TaxonomyId>104</TaxonomyId>
            <ContentType></ContentType>
            <TaxonomyItemStatus>Approved</TaxonomyItemStatus>
            <ContentSubType>Content</ContentSubType>
            <TaxonomyLanguage>1033</TaxonomyLanguage>
            <TaxonomyItemId>60</TaxonomyItemId>
            <TaxonomyItemLanguage>1033</TaxonomyItemLanguage>
            <TaxonomyItemType>1</TaxonomyItemType>
            <TaxonomyItemAddedUser>0</TaxonomyItemAddedUser>
            <TaxonomyItemTitle>OfficeMax</TaxonomyItemTitle>
            <TaxonomyItemTeaser>
                <p>
                    OfficeMax offers flexibility for your office supply needs with ways to purchase on-line, in-store, and over the telephone!
                </p>
            </TaxonomyItemTeaser>
            <TaxonomyItemQuickLink>/officemax.aspx</TaxonomyItemQuickLink>
            <TaxonomyItemEditorLastName>Jane</TaxonomyItemEditorLastName>
            <TaxonomyItemEditorFirstName>Doe</TaxonomyItemEditorFirstName>
            <TaxonomyItemDateModified>12/22/2010 8:21:20 PM</TaxonomyItemDateModified>
            <TaxonomyItemDisplayDateModified>12/22/2010 8:21:20 PM</TaxonomyItemDisplayDateModified>
            <TaxonomyItemDisplayDateCreated>12/21/2010 2:27:46 PM</TaxonomyItemDisplayDateCreated>
            <TaxonomyItemThumbnail></TaxonomyItemThumbnail>
            <TaxonomyItemImage></TaxonomyItemImage>
            <TaxonomyItemHtml>
                <root>
                    <Logo>
                        <img alt="OfficeMax" src="/uploadedImages/Content/Core_Programs/OfficeMax.gif" />
                    </Logo>

                    <VendorName>OfficeMax</VendorName>
                    <ProgramHeadline>In-store and Online Savings on Office Supplies and More</ProgramHeadline>
                    <ProgramSummary>OfficeMax offers flexibility for your office supply needs with ways to purchase on-line, in-store, and over the telephone!</ProgramSummary>
                    <ProgramDetails>
                        <h3>Program&#160;Benefits:</h3>
                        <ul>
                            <li>Some stuff here</li>
                            <li>Some stuff here</li>
                            <li>Some stuff here</li>
                        </ul>
                    </ProgramDetails>
                    <ContactName>John Smith</ContactName>

                    <ContactEmail>johnsmith@xxxxxxxxxxx.com</ContactEmail>
                    <ContactPhone>555.555.1234</ContactPhone>
                    <ContactFax></ContactFax>
                    <WebsiteURL></WebsiteURL>
                </root>
            </TaxonomyItemHtml>
            <TaxonomyItemObjectType>0</TaxonomyItemObjectType>
            <TaxonomyItemFilePath>officemax.aspx</TaxonomyItemFilePath>
            <TaxonomyItemFolderId>76</TaxonomyItemFolderId>
            <TaxonomyItemGoLiveDate>0001-01-01T00:00:00</TaxonomyItemGoLiveDate>
            <TaxonomyItemEndDate>0001-01-01T00:00:00</TaxonomyItemEndDate>
        </TaxonomyItemData>
    </TaxonomyItems>
    <Taxonomy></Taxonomy>
    <FolderId>-1</FolderId>
</TaxonomyData>

Open in new window

Avatar of alicia1234
alicia1234
Flag of United States of America image

ASKER

And here is the XSLT file ...
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes"/>
    <xsl:template match="//TaxonomyItems">
        <!-- <xsl:copy-of select="."/> -->
        <ul class="nps_programs">
            <xsl:apply-templates select="//TaxonomyItemData" />
        </ul>
    </xsl:template>
    <xsl:template match="TaxonomyItemData">
        <div class="nps_program_summary_top">
        </div>
        <div class="nps_program_summary">
            <table>
                <tr>
                    <td class="nps_program_image_container">
                        <a>
                            <xsl:attribute name="href">
                                <xsl:value-of select="TaxonomyItemQuickLink"/>
                            </xsl:attribute>
                            <xsl:attribute name="title">
                                <xsl:value-of select="TaxonomyItemHtml/root/VendorName"/>
                            </xsl:attribute>
                            <img class="nps_program_image">
                                <xsl:attribute name="src">
                                    <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@src"/>
                                </xsl:attribute>
                                <xsl:attribute name="alt">
                                    <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@alt"/>
                                </xsl:attribute>
                            </img>
                        </a>
                    </td>
                    <td class="nps_program_summary">
                        <h2>
                            <xsl:copy-of select="TaxonomyItemHtml/root/ProgramHeadline/text()" />
                        </h2>
                        <p>
                            <xsl:copy-of select="TaxonomyItemHtml/root/ProgramSummary/node()" />
                        </p>
                        <a>
                            <xsl:attribute name="href">
                                <xsl:value-of select="TaxonomyItemQuickLink"/>
                            </xsl:attribute>
                            <xsl:attribute name="title">
                                <xsl:value-of select="TaxonomyItemHtml/root/VendorName"/>
                            </xsl:attribute>
                            Learn More
                        </a>
                    </td>
                </tr>
            </table>
        </div>
        <div class="nps_program_summary_bot">
        </div>
    </xsl:template>
</xsl:stylesheet>

Open in new window

I think it's because you have two TaxonomyItemHTML tags in your XML file.

HTH,

Dale Harris
Yes there are two but they are each inside their own <TaxonomyItemData> tag ... for every item in my "taxonomy", there is this tag. So basically I'm trying to process every item in the taxonomy.
The hierarchy, in general, is:

<TaxonomyData>
    <TaxonomyItems>
        <TaxonomyItemData>
            <TaxonomyItemHtml>
                <root>
                </root>
            </TaxonomyItemHtml>
         </TaxonomyItemData>
         <TaxonomyItemData>
            <TaxonomyItemHtml>
                <root>
                </root>
            </TaxonomyItemHtml>
         </TaxonomyItemData>
    </TaxonomyItems>
</TaxonomyData>
I can tell by looking at the generated HTML that the proper items are being found (there are two); it's just that below that <root> node, I don't seem to be able to access anything.
After re-looking at your code, I realize you have dupes of everything, but I think it's getting confused because when I put it through my XML parser, the TaxonomyItemHTML tags is as far as I can get as well.  There's something in there messing it up, and it's not XSLT, it's the XML itself that's causing the issue IMO.

There are multiple tags below TaxonomyItemHTML, but I can only get to:

$XML.taxonomydata.taxonomyitems.taxonomyitemdata

When I put in the next level, it shows me absolutely nothing.  There's some error in there I'm assuming from this.

When I changed TaxonomyItemData to TaxonomyItemData1 on the second iteration, it worked just fine.  I think having duplicate names for the same level is causing the issue.

HTH,

Dale Harris
Weird. I have no control over the XML - it's being generated by the Ektron content management system.
The whole idea of XML is to be able to have multiples, right (like the classic business card example).

Here's the other XML that I'm able to process just fine ... note that the analogies between this and my taxonomy example are:

<Collection>  <==>  <TaxonomyItems>
<Content> <==> <TaxonomyItemData>
<Html>  <==>  <TaxonomyHtml>

Nesting seems to be the same so I don't get why one works and the other doesn't.

I'm new at this - what are you using to test/parse with?




<?xml version="1.0" encoding="utf-8" ?>
<Collection>
    <Content>
        <ID>55</ID>
        <Type>Content</Type>
        <Title>Chase Paymentech</Title>
        <QuickLink>/chase_paymentech.aspx</QuickLink>
        <Teaser>
            <p>
                Chase Paymentech
                
            </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:43:19 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/chase_paymentech.aspx">Chase Paymentech</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:43:19 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/chase_paymentech.aspx</FilePath>
        <DateCreated>12/21/2010 1:56:13 PM</DateCreated>
    </Content>
    <Content>
        <ID>53</ID>
        <Type>Content</Type>
        <Title>Discount School Supply</Title>
        <QuickLink>/discount_school_supply.aspx</QuickLink>
        <Teaser>
            <p>
                Discount School Supply

            </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:44:20 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/discount_school_supply.aspx">Discount School Supply</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:44:20 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/discount_school_supply.aspx</FilePath>
        <DateCreated>12/20/2010 5:17:33 PM</DateCreated>
    </Content>
    <Content>
        <ID>54</ID>
        <Type>Content</Type>
        <Title>FoodSource Plus</Title>
        <QuickLink>/foodsource_plus.aspx</QuickLink>
        <Teaser>
            <p>
                FoodSource
                
            </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:44:55 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/foodsource_plus.aspx">FoodSource Plus</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:44:55 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/foodsource_plus.aspx</FilePath>
        <DateCreated>12/20/2010 5:27:49 PM</DateCreated>
    </Content>
    <Content>
        <ID>58</ID>
        <Type>Content</Type>
        <Title>Grainger</Title>
        <QuickLink>/grainger.aspx</QuickLink>
        <Teaser>
            <p>
                Grainger
                Facilities, Maintenance, Safety and More
                
            </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:52:51 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/grainger.aspx">Grainger</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:52:51 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/grainger.aspx</FilePath>
        <DateCreated>12/21/2010 2:10:56 PM</DateCreated>
    </Content>
    <Content>
        <ID>59</ID>
        <Type>Content</Type>
        <Title>Monster.com</Title>
        <QuickLink>/monster.aspx</QuickLink>
        <Teaser>
            <p>
                Monster.com
                Post job ads for less
     </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:53:20 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/monster.aspx">Monster.com</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:53:20 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/monster.aspx</FilePath>
        <DateCreated>12/21/2010 2:15:26 PM</DateCreated>
    </Content>
    <Content>
        <ID>60</ID>
        <Type>Content</Type>
        <Title>OfficeMax</Title>
        <QuickLink>/officemax.aspx</QuickLink>
        <Teaser>
            <p>
                OfficeMax
                In-store and Online Savings on Office Supplies and More
         
            </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:45:59 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/officemax.aspx">OfficeMax</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:45:59 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/officemax.aspx</FilePath>
        <DateCreated>12/21/2010 2:27:46 PM</DateCreated>
    </Content>
    <Content>
        <ID>62</ID>
        <Type>Content</Type>
        <Title>Sprint</Title>
        <QuickLink>/sprint.aspx</QuickLink>
        <Teaser>
            <p>
                Sprint
                Discounts on cell service, mobile phones and mobile broadband
            </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:46:24 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/sprint.aspx">Sprint</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:46:24 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/sprint.aspx</FilePath>
        <DateCreated>12/21/2010 2:54:14 PM</DateCreated>
    </Content>
    <Content>
        <ID>65</ID>
        <Type>Content</Type>
        <Title>VSI</Title>
        <QuickLink>/vsi.aspx</QuickLink>
        <Teaser>
            <p>
                VSI
                Background Checks and Drug Testing
            </p>
        </Teaser>
        <Html></Html>
        <StartDate>1/1/0001 12:00:00 AM</StartDate>
        <DateModified>12/21/2010 3:46:59 PM</DateModified>
        <EndDate>12/31/9999 12:00:00 AM</EndDate>
        <LastEditorFname>Jane</LastEditorFname>
        <LastEditorLname>Doe</LastEditorLname>
        <Hyperlink>
            <a href="/vsi.aspx">VSI</a>
        </Hyperlink>
        <DisplayStartDate></DisplayStartDate>
        <FolderID>76</FolderID>
        <ContentStatus>A</ContentStatus>
        <Language>1033</Language>
        <DisplayDateModified>12/21/2010 3:46:59 PM</DisplayDateModified>
        <DisplayEndDate></DisplayEndDate>
        <EndDateAction>Archive_Expire</EndDateAction>
        <Comment></Comment>
        <Image>/WorkArea/images/application/spacer.gif</Image>
        <ImageThumbnail>/WorkArea/images/application/spacer.gif</ImageThumbnail>
        <FilePath>/vsi.aspx</FilePath>
        <DateCreated>12/21/2010 3:08:43 PM</DateCreated>
    </Content>
</Collection>

Open in new window

I'm parsing with Powershell.  If you notice, your "Content" tags all have a different ID.  Yours have the same "104".

Does that fix the issue?

Dale Harris
The content example is a "collection" of content items, each having a unique ID, so yes, the id's are different.

Taxonomy works differently - it's returning every item assigned to the taxonomy. The taxonomy I'm testing with has ID=104 -  so I think it's merely saying "this is the item in the taxonomy" and the "taxonomy that it is in has the id of 104".  It really shouldn't matter what the value of the tags is anyways - should it?
Well your previous XML file you provided with the content tags are acting the same way for me as the ItemHTML tags we are working with.

Can you try testing it by changing one of the IDs and see if it works out before we discount it as an issue?

Dale Harris
I can't change ID's ... they are fundamental to the Ektron CMS and are unchangeable ... they uniquely identify items in the CMS.

I will probably have to wait til after the holidays to contact Ektron.

Here's the XSLT that processes the "Collection" XML with no problems ...


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes"/>
    <xsl:template match="//Collection">
        <!-- <xsl:copy-of select="."/> -->

        <ul class="nps_programs">
            <xsl:apply-templates select="//Content" />
        </ul>
    </xsl:template>
    <xsl:template match="Content">


        <div class="nps_program_summary_top">
        </div>

        <div class="nps_program_summary">

            <table>
                <tr>
                    <td class="nps_program_image_container">
                        <a> <!-- make the image clickable -->
                            <xsl:attribute name="href">
                                <xsl:value-of select="QuickLink"/>
                            </xsl:attribute>
                            <xsl:attribute name="title">
                                <xsl:value-of select="Title"/>
                            </xsl:attribute>
                            <img class="nps_program_image">
                                <xsl:attribute name="src">
                                    <xsl:value-of select="Html/root/Logo/img//@src"/>
                                </xsl:attribute>
                                <xsl:attribute name="alt">
                                    <xsl:value-of select="Html/root/Logo/img//@alt"/>
                                </xsl:attribute>
                            </img>

                        </a>
                    </td>
                    <td class="nps_program_summary">
                        <h2>
                            <xsl:copy-of select="Html/root/ProgramHeadline/text()" />
                        </h2>
                        <p>
                            <xsl:copy-of select="Html/root/ProgramSummary/node()" />
                        </p>
                        <a>
                            <xsl:attribute name="href">
                                <xsl:value-of select="QuickLink"/>
                            </xsl:attribute>
                            <xsl:attribute name="title">
                                <xsl:value-of select="Title"/>
                            </xsl:attribute>
                            Learn More
                        </a>

                    </td>
                </tr>
            
            </table>

        
        </div>
        <div class="nps_program_summary_bot">
        </div>        
    </xsl:template>
</xsl:stylesheet>

Open in new window

Thanks for your help ... I'll report back after I am able to talk with Ektron. Could be another week, given the holidays.
I see what you're saying now.  Well, Alicia, I really appreciate you walking me through your problem.  I don't have the ability to test it like you do on your end.  It looks like you're doing everything the way it should be done and your Ts seem to be crossed and Is dotted on the XML file, so you can rule out that issue.  At least we have a lot more for other Experts to work from when looking at your issue :)  It was fun trying to help Office Max fix a problem with their website.

Good luck on your issue!

Dale Harris
OK thanks ... it's not OfficeMax website though ... ;-) It's a site that has a relationship with them ... can't reveal the identity here.
Avatar of Gertone (Geert Bormans)
If I run the XSLT against the XML you posted, I get all the nodes correctly as expected.

This is NOT at all a problem of duplicate TaxonomyItemHTML elements are non distinct IDs.
Some guessing in the wild is putting us in the wrong direction

Your question makes me very suspicious

If I see this

This also works (I get everything in the node):
<xsl:copy-of select="TaxonomyItemHtml/node()"/>

But if I try this, I don't get anything:
<xsl:copy-of select="TaxonomyItemHtml/root/node()"/>


and I look at the source XML, I have a strong suspicion that you hand crafted the XML, for not revealing sensitive data
Did you by any chance also removed the namespace?
It looks like that
Is there in the original XML, in the <root> tag something like this
<root xmlns="...">
Because that is a typical source for this problem

just to be sure,
can you try this
<xsl:copy-of select="TaxonomyItemHtml/*[local-name() = 'root']/node()"/>
instead of
<xsl:copy-of select="TaxonomyItemHtml/root/node()"/>
and tell me what you see?
Hi Gertrone. Thanks. No I did not handcraft the XML - it's generated by the Ektron Content Management System so I have no control over it (nor is it well-documented). It is very possible that it is "bad" and I do have a support ticket in to them.
 I'm just trying to process the XML. The way Ektron works is you put their controls on a page (using ASP.NET and C#), and then you can specify, as a property of the control, what XSLT file to use to render their XML output the way you want to see it. (Sorry ... I'm new at this so all of the terminology might not be quite correct!)

The way that I got the XML was to put this at the beginning of the XSLT file:
<xsl:template match="/">
        <xsl:copy-of select="."/
    </xsl:template>
Then I view source in the browser, find the XML and copy/paste into Visual Web Developer so it's readable.

What I reported earlier is what I see.

If you meant to literally enter "local-name" - I see nothing. (Sorry if I'm being dumb!) If I'm supposed to substitute "local-name" with host, please let me know exactly what I'm supposed to put in there. I access the site like this:
http://dev.mysite.net

Thanks!
 
you literaly have to input local-name(), it is a function that gives you the local name (without namespace)

First, let us try something else.
I would like to see the real source, not sure that copy-of is giving you all the nuances here

Can you use this as the XSLT and see what you get

Then also make sure that there are no extra filters after that
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="node()">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

Open in new window

In the browser, I basically see all of the content that I am trying to get to but without the xml tags.

Do you need me to grab the source XML and post that? (It's really long ... )
OK so I have to leave the office now ... will check back in later today. THANK YOU for your help.
I prefer the whole xml indeed, you can attach, you can even zip or email me a zip on my email (see profile) if the data is a bit sensitive
Of course you won't see anything in teh browser,
a browser will interpret tags it knows and ignore tags it doen't know, you need to view source
Ok ... on the road now ... will email in a couple of hours. Thanks.
Gertrone - I just emailed the entire source of the page to you. Sorry for the delay. Thanks.
Well, I saw, did not find any weird namespaces in your source data
I reordered your XSLT a little,
(I found that some element names were different)

Maybe you can try this and say what you see
(note that I added items in your <ul>, it is a bit weird to have a list without items)
It could have been that stuff was really there but that you did not see them because of the structural issues in the resulting HTML
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    
    <xsl:template match="TaxonomyData">
        <xsl:apply-templates select=".//TaxonomyItems" ></xsl:apply-templates>
    </xsl:template>

    <xsl:template match="TaxonomyItems">
        <ul class="nps_programs">
            <xsl:apply-templates select="TaxonomyItemData" />
        </ul>
    </xsl:template>

    <xsl:template match="TaxonomyItemData">
        <li>
            <div class="nps_program_summary_top">
            </div>
            
            <div class="nps_program_summary">
                <table>
                    <tr>
                        <td class="nps_program_image_container">
                            <a> <!-- make the image clickable -->
                                <xsl:attribute name="href">
                                    <xsl:value-of select="TaxonomyItemQuickLink"/>
                                </xsl:attribute>
                                <xsl:attribute name="title">
                                    <xsl:value-of select="TaxonomyItemTitle"/>
                                </xsl:attribute>
                                <img class="nps_program_image">
                                    <xsl:attribute name="src">
                                        <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@src"/>
                                    </xsl:attribute>
                                    <xsl:attribute name="alt">
                                        <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@alt"/>
                                    </xsl:attribute>
                                </img>
                                
                            </a>
                        </td>
                        <td class="nps_program_summary">
                            <h2>
                                <xsl:copy-of select="TaxonomyItemHtml/root/ProgramHeadline/text()" />
                            </h2>
                            <p>
                                <xsl:copy-of select="TaxonomyItemHtml/root/ProgramSummary/node()" />
                            </p>
                            <a>
                                <xsl:attribute name="href">
                                    <xsl:value-of select="TaxonomyItemQuickLink"/>
                                </xsl:attribute>
                                <xsl:attribute name="title">
                                    <xsl:value-of select="TaxonomyItemTitle"/>
                                </xsl:attribute>
                                <xsl:text>Learn More</xsl:text>
                            </a>
                            
                        </td>
                    </tr>
                    
                </table>
                
                
            </div>
            <div class="nps_program_summary_bot">
            </div>        
        </li>
    </xsl:template>
</xsl:stylesheet>

Open in new window

Thanks. Unfortunately, your xsl doesn't make any difference ... :-(
Same result as before except now, of course, I've got the bullets for the <li>
so, my xsl does not make a diffrence at all?
(ignore the bullets)

OK, how do you conclude that "the data is not copied"?
- because you don't see it?
- because it is not in the source?

We need to exclude all possiblem issues such as CSS, other stylesheets having an impact

It is a good thing by the way that you see the bullets for the <li>, at least we know the processing gets to that point,
so leave them there until we are done

Can you show us what you experience? You can obfuscate the data that is sensible
I removed the bullets (in the css) but here's a screen shot of what I see:
http://screencast.com/t/9bmCfRWJsk7f

Here's a screen shot of what I'm looking at using Firebug in Firefox; note the empty src, alt, h2, etc... this is examining the first "box" of the three.
http://screencast.com/t/VQeHO2YrVw2m
OK, let's go debugging :-)

Can you try the below XSLT and show me theFirebug screenshot?
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes" method="xhtml"/>
    
    <xsl:template match="TaxonomyData">
        <xsl:apply-templates select=".//TaxonomyItems" ></xsl:apply-templates>
    </xsl:template>

    <xsl:template match="TaxonomyItems">
        <ul class="nps_programs">
            <xsl:apply-templates select="TaxonomyItemData" />
        </ul>
    </xsl:template>

    <xsl:template match="TaxonomyItemData">
        <li>
            <div class="nps_program_summary_top">
            </div>
            
            <div class="nps_program_summary">
                <table>
                    <tr>
                        <td class="nps_program_image_container">
                            <xsl:text>{</xsl:text>
                            <xsl:copy-of select="TaxonomyItemHtml"/>
                            <xsl:text>}</xsl:text>
                            <xsl:text>[</xsl:text>
                            <xsl:copy-of select="TaxonomyItemHtml/root"/>
                            <xsl:text>]</xsl:text>
                            <xsl:text>(</xsl:text>
                            <xsl:copy-of select="TaxonomyItemHtml/root/Logo"/>
                            <xsl:text>)</xsl:text>
                            <a> <!-- make the image clickable -->
                                <xsl:attribute name="href">
                                    <xsl:value-of select="TaxonomyItemQuickLink"/>
                                </xsl:attribute>
                                <xsl:attribute name="title">
                                    <xsl:value-of select="TaxonomyItemTitle"/>
                                </xsl:attribute>
                                <img class="nps_program_image">
                                    <xsl:attribute name="src">
                                        <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@src"/>
                                    </xsl:attribute>
                                    <xsl:attribute name="alt">
                                        <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@alt"/>
                                    </xsl:attribute>
                                </img>
                                
                            </a>
                        </td>
                        <td class="nps_program_summary">
                            <h2>
                                <xsl:copy-of select="TaxonomyItemHtml/root/ProgramHeadline/text()" />
                            </h2>
                            <p>
                                <xsl:copy-of select="TaxonomyItemHtml/root/ProgramSummary/node()" />
                            </p>
                            <a>
                                <xsl:attribute name="href">
                                    <xsl:value-of select="TaxonomyItemQuickLink"/>
                                </xsl:attribute>
                                <xsl:attribute name="title">
                                    <xsl:value-of select="TaxonomyItemTitle"/>
                                </xsl:attribute>
                                <xsl:text>Learn More</xsl:text>
                            </a>
                            
                        </td>
                    </tr>
                    
                </table>
                
                
            </div>
            <div class="nps_program_summary_bot">
            </div>        
        </li>
    </xsl:template>
</xsl:stylesheet>

Open in new window

I emailed you the screen shots ... there is sensitive stuff in them so can't post them here.
lets dive deeper,
ekron likely constructs this XML in a weird fashion and the objectmodel fails to grab it as one XML.
So we need to figure out what goes wrong.
It is weird allready (sorry for abusing you as a debug engine :-)
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes" method="xhtml"/>
    
    <xsl:template match="TaxonomyData">
        <xsl:apply-templates select=".//TaxonomyItems" ></xsl:apply-templates>
    </xsl:template>

    <xsl:template match="TaxonomyItems">
        <ul class="nps_programs">
            <xsl:apply-templates select="TaxonomyItemData" />
        </ul>
    </xsl:template>

    <xsl:template match="TaxonomyItemData">
        <li>
            <div class="nps_program_summary_top">
            </div>
            
            <div class="nps_program_summary">
                <ul>
                    <xsl:for-each select="TaxonomyItemHtml/node()">
                        <li>
                            <xsl:value-of select="name()"/>
                            <xsl:text> # </xsl:text>
                            <xsl:value-of select="local-name()"/>
                            <xsl:text> # </xsl:text>
                            <xsl:value-of select="namespace-uri()"/>
                        </li>
                    </xsl:for-each>
                </ul>
                <table>
                    <tr>
                        <td class="nps_program_image_container">
                            <xsl:text>{</xsl:text>
                            <xsl:copy-of select="TaxonomyItemHtml"/>
                            <xsl:text>}</xsl:text>
                            <xsl:text>[</xsl:text>
                            <xsl:copy-of select="TaxonomyItemHtml/*[translate(local-name(), 'TRO', 'tro') = 'root']"/>
                            <xsl:text>]</xsl:text>
                            <xsl:text>(</xsl:text>
                            <xsl:copy-of select="TaxonomyItemHtml/root/Logo"/>
                            <xsl:text>)</xsl:text>
                            <a> <!-- make the image clickable -->
                                <xsl:attribute name="href">
                                    <xsl:value-of select="TaxonomyItemQuickLink"/>
                                </xsl:attribute>
                                <xsl:attribute name="title">
                                    <xsl:value-of select="TaxonomyItemTitle"/>
                                </xsl:attribute>
                                <img class="nps_program_image">
                                    <xsl:attribute name="src">
                                        <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@src"/>
                                    </xsl:attribute>
                                    <xsl:attribute name="alt">
                                        <xsl:value-of select="TaxonomyItemHtml/root/Logo/img//@alt"/>
                                    </xsl:attribute>
                                </img>
                                
                            </a>
                        </td>
                        <td class="nps_program_summary">
                            <h2>
                                <xsl:copy-of select="TaxonomyItemHtml/root/ProgramHeadline/text()" />
                            </h2>
                            <p>
                                <xsl:copy-of select="TaxonomyItemHtml/root/ProgramSummary/node()" />
                            </p>
                            <a>
                                <xsl:attribute name="href">
                                    <xsl:value-of select="TaxonomyItemQuickLink"/>
                                </xsl:attribute>
                                <xsl:attribute name="title">
                                    <xsl:value-of select="TaxonomyItemTitle"/>
                                </xsl:attribute>
                                <xsl:text>Learn More</xsl:text>
                            </a>
                            
                        </td>
                    </tr>
                    
                </table>
                
                
            </div>
            <div class="nps_program_summary_bot">
            </div>        
        </li>
    </xsl:template>
</xsl:stylesheet>

Open in new window

OK ... just emailed screen shots to you. Not feeling abused at all ... I'm learning something! Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much! If I get any other info from Ektron, I will post it here.