COntinous category List

Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Sep 2007
Posts: 3
Reputation: googletired is an unknown quantity at this point 
Solved Threads: 0
googletired googletired is offline Offline
Newbie Poster

COntinous category List

 
0
  #1
Mar 18th, 2008
Hello,

It has been quite some time since I have done any .xml/.xsl work

My current site displays the contents of the category (only) when clicked. What I need it to do is display a Long list of all content from all categories seperated by Category heading. Also when a specific category is clicked it will need jump down the page to the proper heading.

This is read from the master .xml or as stated below vol_issue

Code for vol_issue file.

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <vol_issue vol_issue_id="200803">
  3. <description>month here</description>
  4. <language>en</language>
  5. <type>print</type>
  6. <xmlfilename>en_print_200803.xml</xmlfilename>
  7. <cdfilename>cd_en_print_200803.xml</cdfilename>
  8. <category category_id="54">
  9. <sort_order>1</sort_order>
  10. <article article_id="#####"/>
  11. <article article_id="#####"/>
  12. <article article_id="#####"/>
  13. <article article_id="#####"/>
  14. <article article_id="#####"/>
  15. </category>
  16.  
  17. <category category_id="2">
  18. <sort_order>2</sort_order>
  19. <article article_id="#####"/>
  20. <article article_id="#####"/>
  21. <article article_id="#####"/>
  22. <article article_id="#####"/>
  23. <article article_id="#####"/>
  24. </category>
  25. </vol_issue>

Code for article listing .XSL

  1. <?xml version='1.0' encoding='utf-8' ?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  3. <xsl:output method="html" encoding="ISO-8859-1" omit-xml-declaration="yes"/>
  4.  
  5. <xsl:param name="pagename">default.asp?pagename=media&amp;content=getcontent</xsl:param>
  6. <xsl:param name="lang">en</xsl:param>
  7. <xsl:param name="type">print</xsl:param>
  8. <xsl:param name="vol">200304</xsl:param>
  9. <xsl:param name="cat">2</xsl:param>
  10. <xsl:param name="articleid">12345</xsl:param>
  11. <xsl:param name="mode">preview</xsl:param>
  12. <xsl:param name="target">email</xsl:param>
  13. <xsl:param name="selectedcat"></xsl:param>
  14.  
  15. <xsl:variable name="strBaseURL"><xsl:value-of select="concat('type=',$type,'&amp;lang=',$lang,'&amp;vol=',$vol,'&amp;cat=',$cat,'&amp;articleid=',$articleid)"></xsl:value-of></xsl:variable>
  16.  
  17. <xsl:variable name="default" select="document('../xml/default.xml')/main/site[@language=$lang]"/>
  18.  
  19. <xsl:variable name="website_IP"><xsl:value-of select="$default/website_IP"/></xsl:variable>
  20.  
  21. <xsl:variable name="twidth">
  22. <xsl:choose>
  23. <xsl:when test="$target='web'"><xsl:text>100%</xsl:text></xsl:when>
  24. <xsl:otherwise><xsl:text>750</xsl:text></xsl:otherwise>
  25. </xsl:choose>
  26. </xsl:variable>
  27.  
  28. <xsl:variable name="image_dir">
  29. <xsl:choose>
  30. <xsl:when test="$target='web'"><xsl:value-of select="$default/web_article_images_url"/></xsl:when>
  31. <xsl:when test="$target='email' or $target='index'"><xsl:value-of select="$website_IP"/><xsl:value-of select="$default/web_article_images_url"/></xsl:when>
  32. <xsl:when test="$target='cd'"><xsl:value-of select="$default/cd_article_images_url"/></xsl:when>
  33. </xsl:choose>
  34. </xsl:variable>
  35.  
  36.  
  37.  
  38. <xsl:variable name="viewpagename"><xsl:text>default.asp?pagename=media&amp;content=getcontent</xsl:text></xsl:variable>
  39. <xsl:variable name="downloadpagename"><xsl:text>default.asp?pagename=media&amp;content=getcontent</xsl:text></xsl:variable>
  40.  
  41. <xsl:template match="vol_issue">
  42. <xsl:variable name="view_text">
  43. <xsl:choose>
  44. <xsl:when test="type = 'print' or type = 'web'">
  45. <xsl:choose>
  46. <xsl:when test="language='en'">View this article</xsl:when>
  47. <xsl:otherwise>Visualiser cet article</xsl:otherwise>
  48. </xsl:choose>
  49. </xsl:when>
  50. <xsl:when test="type = 'digital'">
  51. <xsl:choose>
  52. <xsl:when test="language='en'">Watch this video</xsl:when>
  53. <xsl:otherwise>Regarder ce vidéo</xsl:otherwise>
  54. </xsl:choose>
  55. </xsl:when>
  56. <xsl:when test="type = 'pr'">
  57. <xsl:choose>
  58. <xsl:when test="language='en'">View this release</xsl:when>
  59. <xsl:otherwise>Visualiser ce communiqué</xsl:otherwise>
  60. </xsl:choose>
  61. </xsl:when>
  62. <xsl:otherwise>
  63. <xsl:choose>
  64. <xsl:when test="language='en'">View this script</xsl:when>
  65. <xsl:otherwise>Visualiser ce script</xsl:otherwise>
  66. </xsl:choose>
  67. </xsl:otherwise>
  68. </xsl:choose>
  69. </xsl:variable>
  70.  
  71. <xsl:variable name="email_text">
  72. <xsl:choose>
  73. <xsl:when test="type ='print' or type='web'">
  74. <xsl:choose>
  75. <xsl:when test="language='en'">E-mail me this article</xsl:when>
  76. <xsl:otherwise>Veuillez me transmettre cet article par courriel</xsl:otherwise>
  77. </xsl:choose>
  78. </xsl:when>
  79. <xsl:when test="type ='pr'">
  80. <xsl:choose>
  81. <xsl:when test="language='en'">E-mail me this release</xsl:when>
  82. <xsl:otherwise>Envoyer ce communiqué par courriel</xsl:otherwise>
  83. </xsl:choose>
  84. </xsl:when>
  85. <xsl:when test="type ='digital'">
  86. </xsl:when>
  87. <xsl:otherwise>
  88. <xsl:choose>
  89. <xsl:when test="language='en'">E-mail me this script</xsl:when>
  90. <xsl:otherwise>Veuillez me transmettre ce script par courriel</xsl:otherwise>
  91. </xsl:choose>
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </xsl:variable>
  95.  
  96. <xsl:variable name="cat_description" select="document('../articles/categories.xml')/main/category[@category_id = $cat]/description"/>
  97. <xsl:variable name="category_lookup" select="document('../articles/categories.xml')"/>
  98.  
  99. <xsl:choose>
  100. <xsl:when test="$target = 'web'">
  101. <div class="ln-text">
  102. <xsl:for-each select="category">
  103. <xsl:sort select="sort_order" data-type="number" order="ascending" />
  104. <xsl:variable name="catid" select="@category_id"/>
  105. <xsl:variable name="classname">
  106. <xsl:choose>
  107. <xsl:when test="$catid = $selectedcat"><xsl:text>ln-slink</xsl:text></xsl:when>
  108. <xsl:otherwise><xsl:text>ln-alink</xsl:text></xsl:otherwise>
  109. </xsl:choose>
  110. </xsl:variable>
  111. <xsl:text> </xsl:text><a href="{$strBaseURL}&amp;vol={/vol_issue/@vol_issue_id}&amp;cat={$catid}" id="{$catid}" class="{$classname}"><xsl:value-of select="$category_lookup/main/category[@category_id = $catid]/description"/>:<xsl:value-of select="count(article)"/>
  112.  
  113. </a><br/>
  114. </xsl:for-each>
  115. </div>
  116. </xsl:when>
  117. </xsl:choose>
  118.  
  119. <div class="m-bcategory"><h1><xsl:value-of select="$cat_description"/></h1></div>
  120.  
  121. <xsl:for-each select="category[@category_id = $cat]/article">
  122. <xsl:variable name="article" select="document(concat('../articles/', @article_id, '.xml'))"/>
  123. <div class="m-blurbwrapper">
  124. <div class="m-bheadline"><a class="m-bheadline" href="{$viewpagename}&amp;type={../../type}&amp;lang={../../language}&amp;vol={../../@vol_issue_id}&amp;cat={../@category_id}&amp;articleID={@article_id}&amp;mode=view&amp;id={$article/article/video/file/file_name}"><xsl:value-of select="$article/article/headline"/></a></div>
  125.  
  126. <div class="m-awordcount">
  127. <xsl:value-of select="$article/article/body_text/wordcount"/>
  128. </div>
  129. <xsl:if test="../../type='print' or ../../type='web'">
  130. <div class="m-thumbnail">
  131.  
  132. <img height="50" width="70">
  133. <xsl:attribute name="src">
  134. <xsl:value-of select="$image_dir"/>
  135. <xsl:value-of select="$article/article/images/image/source"/>
  136. <!--<xsl:if test="$article/article/images/image/source = '' ">
  137. noimage.jpg</xsl:if>-->
  138. <xsl:choose>
  139. <xsl:when test="$article/article/images/image/source = '' and $lang='en' ">noimage.jpg</xsl:when>
  140. <xsl:when test="$article/article/images/image/source = '' and $lang='fr' ">noimagefre.jpg</xsl:when>
  141. </xsl:choose>
  142. </xsl:attribute>
  143. </img>
  144.  
  145. </div>
  146. </xsl:if>
  147.  
  148.  
  149.  
  150.  
  151.  
  152. <div class="m-bblurb"><xsl:value-of select="$article/article/blurb"/></div>
  153.  
  154.  
  155.  
  156. <div class="m-blink">
  157. <a class="m-blink" href="{$viewpagename}&amp;type={../../type}&amp;lang={../../language}&amp;vol={../../@vol_issue_id}&amp;cat={../@category_id}&amp;articleID={@article_id}&amp;mode=view&amp;id={$article/article/video/file/file_name}">
  158. <xsl:value-of select="$view_text"/>
  159. </a>
  160. <xsl:if test="../../type='print' or ../../type='web' or ../../type='pr' or ../../type='digital'">
  161.    <a class="m-blink" href="{$downloadpagename}&amp;type={../../type}&amp;lang={../../language}&amp;vol={../../@vol_issue_id}&amp;cat={../@category_id}&amp;articleID={@article_id}&amp;mode=email">
  162. <xsl:value-of select="$email_text"/> <!-- <input type="checkbox" value="{@category_id}" name="category_id">
  163. <xsl:value-of select="description"/></input> -->
  164. </a>
  165. </xsl:if>
  166. </div>
  167. </div>
  168. </xsl:for-each>
  169. </xsl:template>
  170. </xsl:stylesheet>

Thanks in advance for all help and or ideas.

Gt
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the RSS, Web Services and SOAP Forum


Views: 1341 | Replies: 0
Thread Tools Search this Thread



Tag cloud for RSS, Web Services and SOAP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC