Technical support This forum is closed.
Version 1.x > Technical support > Displaying Several Document Types View modes: 
User avatar
Member
Member
Chameane - 12/27/2005 12:18:45 PM
   
Displaying Several Document Types
Hi,

I've never used XSLT stylesheets before and I need to display a default transformation for several document types like this:

Document types:

Doc type: Article1
Doc type: Features

Where Features are always child of Article1 types.

When I choose one particular Article1 (default transformation) I should show all fields of article1 doc type and links to all features docs wich are childs of the selected article

Example:
In my content tree I've got:

+Article11
--Features1
--Features2
+Article12
--Features3
+Article13
--Features4
--Features5
--Features6

If I select article11, I should see all his fields and links to features1 and Features2 docs
If I select article12, I should see all his fields and links to features 3
and if I select article13, I should see all his fields and links to features4, features5 and features6

In kentico CMS developper's guide I've found "Writing XSLT Stylesheets" - Displaying severald document types.
I've tryed to adapt it to my needs but I cannot get the desired effect:
What I've made is:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="cms.article1">
<h1><xsl:value-of disable-output-escaping="yes" select="Name" /></h1><BR />
<img><xsl:attribute name="src">~<xsl:value-of select="Photo" />
</xsl:attribute></img><BR />
<b>Text:</b><xsl:value-of disable-output-escaping="yes" select="Text" /><BR />
<b>Bussiness Line: </b><xsl:value-of disable-output-escaping="yes" select="Bussinessline" /><BR />
<b>Category:</b><xsl:value-of disable-output-escaping="yes" select="Category" /><BR />
<p><b>Attach:</b><xsl:call-template name="cms.features">
<xsl:with-param name="parentID">
<xsl:value-of select="article1ID" />
</xsl:with-param>
</xsl:call-template>
<hr/></p>
</xsl:template>
<xsl:template name="cms.features">
<xsl:param name="parentID" />
<xsl:for-each select="/NewDataSet/cms.Features[Product=$parentID]">
<i><xsl:value-of select="InfosPDF" /></i>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Where Product is a field of the cms.features template which saves the ID of the parent element and InfosPDF is the name of a PDF doc wich contains the desired features (once the page will be shown correctly I'll add a link to the PDF files)

If anybody can help me...

Thanks

User avatar
Guest
admin - 12/27/2005 6:35:47 PM
   
Re: Displaying Several Document Types
Hello,

could you please post here which control you are using to display the results and how it's configured?

Thank you.

Best Regards,

User avatar
Member
Member
Chameane - 12/30/2005 2:59:49 PM
   
Re: Displaying Several Document Types
Hi,
I was using a CMSRepeater and it was configured to show cms.article1 items (I don't know how to put several doc types in the configuration), so, I displayed the information contained in the article1 table but the features didn't appeared.
Finally I've almost solved the problem,
I use ascx transformations, and in article1 attributes I've added a multiple choice wich shows all the features and user should check the good ones.
The problem with this approach is that I could not profite of the arborescence of Kentico content.

I've tryed to make a query to show only features that are under the article doc but I haven't found a solution.

-Page wich show article1s docs
--Article1
---Feature1
---Feature2
--Article12
---Feature121
---Feature122
...

The problem is that everything seems refers the page wich shows the article1 docs and then, all the features are child of the page...

User avatar
Guest
admin - 12/30/2005 8:52:04 PM
   
Re: Displaying Several Document Types
It seems you're actually trying to display a hierarchical repeater. Please see Developer's Guide -> Knowledge Base -> KB0015 -> Displaying Hierarchical (Nested) Repeater.

Best Regards,