utahman3431
06-10-2008, 03:54 AM
I was finally able to get some XML data sorted correctly using an XSL document, but I am having some issues with it not staying numbered correctly for a link.
Let me explain a little further.
I have a support site I am creating that doesn't have the option of using server-side scripting. I am using an xml document to hold all of the site information (help articles, contact lists, etc). I was wanting to make it to where I can add a new help article at the bottom of the XML doc and have the XSL stylesheet sort the documents alphabetically. I have the code to where it will finally do that for the article titles:
<xsl:template match="/">
<ul id="subnav">
<xsl:for-each select="help_articles/support_doc">
<xsl:sort select="header" />
<li>
<a href="javascript://" onclick="show({position() - 1})" >
<xsl:value-of select="header" />
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
With the above code I can get a list of all articles to display alphabetically by "header" name. When I click on the corresponding link it will display the correct information until I come to an article that isn't alphabetically placed in the correct location within the XML document:
<support_doc>
<name></name>
<header>DC Ranch</header>
<title>temp</title>
<body>temp</body>
</support_doc>
<support_doc>
<name></name>
<header>Display Language</header>
<title>temp</title>
<body>temp</body>
</support_doc>
<support_doc>
<name>bob</name>
<header>Bob is Testing</header>
<title>Bob is Testing</title>
<body>test</body>
</support_doc>
...
As soon as I click on the link for "Bob is testing" in the menu, it shows the information for the article at that actual position in the XML document.
Am I using the wrong code in the link ({postion()-1})?
Let me explain a little further.
I have a support site I am creating that doesn't have the option of using server-side scripting. I am using an xml document to hold all of the site information (help articles, contact lists, etc). I was wanting to make it to where I can add a new help article at the bottom of the XML doc and have the XSL stylesheet sort the documents alphabetically. I have the code to where it will finally do that for the article titles:
<xsl:template match="/">
<ul id="subnav">
<xsl:for-each select="help_articles/support_doc">
<xsl:sort select="header" />
<li>
<a href="javascript://" onclick="show({position() - 1})" >
<xsl:value-of select="header" />
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
With the above code I can get a list of all articles to display alphabetically by "header" name. When I click on the corresponding link it will display the correct information until I come to an article that isn't alphabetically placed in the correct location within the XML document:
<support_doc>
<name></name>
<header>DC Ranch</header>
<title>temp</title>
<body>temp</body>
</support_doc>
<support_doc>
<name></name>
<header>Display Language</header>
<title>temp</title>
<body>temp</body>
</support_doc>
<support_doc>
<name>bob</name>
<header>Bob is Testing</header>
<title>Bob is Testing</title>
<body>test</body>
</support_doc>
...
As soon as I click on the link for "Bob is testing" in the menu, it shows the information for the article at that actual position in the XML document.
Am I using the wrong code in the link ({postion()-1})?