Subject: XSLT Templates
Posted By: bmains Post Date: 12/16/2003 9:14:00 AM
Hello,

I have the following XML:

<Documents>
  <Section Title="Documentation" Sidebar="false">
    <Document>...</Document>
    <Document>...</Document>
    <Document>...</Document>
  </Section>
  <Section Title="Business Information" Sidebar="false">
    <Document>...</Document>
    <Document>...</Document>
    <Document>...</Document>
  </Section>
  <Section Title="Policy" Sidebar="true">
    <Document>...</Document>
    <Document>...</Document>
    <Document>...</Document>
  </Section>
</Documents>

What I want to do is trigger a different response when the sidebar is true then when false.  In my stylesheet, I had did this:

<xsl:template match="Documents">
  <table>
    <tr>
      <td>
        <xsl:apply-templates select="Section[@Sidebar != 'true']"/>
      </td>
      <td width="20%">
        <xsl:apply-templates select="Section[@Sidebar = 'true']"/>
      </td>
    <tr>
  </table>
</xsl:template>

<xsl:template match="Section[@Sidebar = 'true']">
  ...
</xsl:template>

<xsl:template match="Section[@Sidebar != 'true']">
  ...
</xsl:template>

The sections where sidebar = true is supposed to be on the right side, and the rest in the main page.  I couldn't get this to work.  Any ideas what is wrong?  How do I render content differently based on the sidebar parameter?

Thanks,

Brian Mains
Reply By: joefawcett Reply Date: 12/16/2003 9:53:00 AM
Works for me. What do you mean doesn't work? Can you post the full stylesheet?

--

Joe
Reply By: bmains Reply Date: 12/16/2003 1:36:52 PM
Hello,

I found out the problem I had both a template for:
<template match="Section">
  which had defined in it
    <for-each select="Document">
  
However, I had also defined:

<template match="Document">

Which caused a "No result set could be returned" MSXML parser error.

Sorry for any inconvenience.

Thanks,

Brian

Go to topic 6975

Return to index page 985
Return to index page 984
Return to index page 983
Return to index page 982
Return to index page 981
Return to index page 980
Return to index page 979
Return to index page 978
Return to index page 977
Return to index page 976