Jump to content
Sign in to follow this  

New to XML, Cannot get data to display through XSLT stylesheet.

Recommended Posts

I am in an intro XML class and have an assignment I am stuck on. Basically the scenario is a reality company that needs a way to display their homes for sale in an organized way. We are working with IDs and Keys now and for my assignments I'm given a skeleton of a script and told what to accomplish each step, so I'll just focus on the bits that I entered.


The base script homes.xml links to the XSLT stylesheet homes.xsl which also references an agencies.xml external file which has the information about the different firms and agents for each property.


Ideally it should look like this(taken from the tutorial we followed along with in the chapter, very similar except ordered by city instead of style):



Except when I run the script from the assignment, the links at the top are present but they all have a zero value in their count of all properties with that style, and the table that is supposed to appear below and populate with all of the housing information does not even show as shown here:



Here is the code in the root template that is supposed to step through the styles shown and apply the "property" template which stores the html for the table below using Muenchian grouping:

<h1>New Listings</h1>
               <section id="style_list">
					select="listings/property[not(style=preceding::property/style)]" mode="styleList" >
						<xsl:sort select="style" />
				select="//property[generate-id()=generate-id(key('houseStyles', style)[1])]">
					<xsl:sort select="style" />
					<h2 id="{generate-id()}"><xsl:value-of select="style" /></h2>
					<xsl:apply-templates select="key('houseStyles', style)">
						<xsl:sort select="sqfeet" order="descending" />

I believe the step pattern just below the section element is working as intended since the styles show up at the top, but why does the next "for each" element using the Muenchian grouping not displaying the table as intended? I would post the code for the "property" template, but almost all of it was already written before I started working on it, and I don't think the textbook messed up (possible, but unlikely).


I'm not getting any error codes to go off of, just the blank page shown above. This assignment was very similar to the one I followed along with in the chapter, so I used that as a reference and have looked through everything and cant find what is causing this issue. I can provide more of the code if necessary.


Thanks for your time.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...