Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Better way to filter and sort This XML File

Status
Not open for further replies.

bont

Programmer
Sep 7, 2000
200
US
Hi all, I am blocked on this problem of mine.

I have an XML doc: FROM MY SITE

The current page for it is FROM MY SITE .. Please append ?SS=2003_SPRING|2003_SUMMER&ID=5|31|6 to the URL

The problem is that I use a match to "filter" the larger XML doc. This prohibits a conventional sort to be used on the columns, since the filter is very strict, since I must match the data on a couple different fields and criteria (look at URL)

I guess I have a few questions:

- Can anyone recommend a better way of filtering that may aid me here.
- Can anyone recommend a better XML structure to do the same, since I control it as well (I don't have a web DB, it is local and I drop the files)

My XLS is ON MY SITE

Thanks for any help...
 
I was thinking about it, is this possible:

Is there any way in VB, to use something such as the following:

Code:
<% Language=VBScript %>
<%
Dim objTemplate, objProcessor, strSortField, strGameNumber, objXML, objXSL, strHTML
	Set objXML = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
	Set objXSL = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
	objXML.async = False
	objXML.Load Server.MapPath("XML/Data/SOFTBALL_WEEKS_STATS.xml")
	objXSL.async = False
	objXSL.Load Server.MapPath("XML/Schema/SOFTBALL_WEEKS_COMP_STATS.xsl")
	Set objTemplate = Server.CreateObject("MSXML2.XSLTemplate.3.0")
	Set objTemplate.stylesheet = objXSL
	Set objProcessor = objTemplate.createProcessor
	objProcessor.input = objXML
	objProcessor.addParameter "dYEAR", cstr(Request.QueryString("YY"))
	objProcessor.addParameter "dTRI", cstr(Request.QueryString("TR"))
	objProcessor.addParameter "dWEEKNO", cstr(Request.QueryString("WK"))		
	objProcessor.addParameter "dIDS", cstr(Request.QueryString("ID"))		
	objProcessor.addParameter "dSEASONS", cstr(Request.QueryString("SS"))		
	objProcessor.AddParameter "DataType", cstr(Request.QueryString("ST"))
	objProcessor.AddParameter "SortOrder", cstr(Request.QueryString("SO"))
	objProcessor.AddParameter "SortField", cstr(Request.QueryString("SF"))
	objProcessor.Transform
strHTML = objProcessor.output
Response.write strHTML
%>

I currently have a block on my page, since I have a large XML. Is there a way I can transform to a page (using a filter XSL), and then save the XML file, and use it in another transform, which would allow me to sort freely?
 
I don't understand:
'The problem is that I use a match to "filter" the larger XML doc. This prohibits a conventional sort to be used on the columns'.
If you do this, you can still sort?
Code:
<xsl:call-template name="showlist">
 <xsl:with-param name="smalllist" select="hugelist/item[something=$filter]"/>
</xsl:call-template>

<xsl:template name="showlist">
 <xsl:param name="smalllist"/>
 <xsl:for-each selct="$smalllist/item">
  <xsl:sort select="something"/>
   ...
  </xsl:for-each>
</xsl:template>
 
I still don't see this? I don't understand what you are trying to code, there is no explaination.

If you look at the current "filter" you would see:

1.that the parameters for the filter are passed via URL in
in 2 separate fields
2.the filter fields must be parsed for multiple values

Currently I can not sort on the for each, as the for each is cycling through all 100% of the items in the original XML (very inefficient, I know), and writing over only the current item being compared. I can put a sort command after the for all day long, but it is still only going to match to 1 item on each loop of the for.

I think my solution now should be done on the ASP side. I should transform my current XML to a more simple XML (merging levels), and perform the filter at the same time. Then I should do another call to transform this new XML to the HTML (which is already designed, just needs tweaking).

If anyone has a working example of something similar (passing by URL, because this changes everything), please let me know.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top