How to use DITA subject scheme maps to produce facets for faceted search

StackOverflow https://stackoverflow.com/questions/16737472

  •  30-05-2022
  •  | 
  •  

Domanda

I have a DITA topic map that contains a subject scheme map that defines a taxonomy.

The topics in my topic map have been tagged with values from the taxonomy.

How can I render my topic map with facets to allow retrival of the topics, where the facets are the values from the subject scheme map?

È stato utile?

Soluzione

John.

DITA 1.2 gives you the means to create a taxonomy or facet hierarchy -- the subjectScheme map -- and the means to apply the taxonomy or facet hierarchy to your DITA content -- the classification map.

To take advantage of that markup and implement a faceted-browsing experience, you need two things:

  • A processor that uses the subject classification values as it renders the output
  • A viewing application that implements faceted browsing

Currently, I am not aware of any DITA processors or viewing applications that do this.

Altri suggerimenti

Well, unless I'm misunderstanding the question, I assume you mean rendering to XHTML and that you want the facet metadata in the output for use in retrieval there by the end user? And I guess you want it in a meta tag then.

If so, I would do it like this:

For the sake of the example, I will assume that you have made a taxonomy that maps to the @product attribute.

First, in the stylesheet dita2htmlImpl.xsl, find the following template and copy it to your custom.xsl to override it (as an alternative you could do another override the get-meta template in get-meta.xsl, but it's so long...), and add a call to generateProductMetadata:

<xsl:template match="*" mode="chapterHead">
    <head><xsl:value-of select="$newline"/>
      <!-- initial meta information -->
      <xsl:call-template name="generateCharset"/>   <!-- Set the character set to UTF-8 -->
      <xsl:call-template name="generateDefaultCopyright"/> <!-- Generate a default copyright, if needed -->
      <xsl:call-template name="generateDefaultMeta"/> <!-- Standard meta for security, robots, etc -->
      <xsl:call-template name="getMeta"/>           <!-- Process metadata from topic prolog -->
      <xsl:call-template name="copyright"/>         <!-- Generate copyright, if specified manually -->
      <xsl:call-template name="generateCssLinks"/>  <!-- Generate links to CSS files -->
      <xsl:call-template name="generateChapterTitle"/> <!-- Generate the <title> element -->
      <xsl:call-template name="gen-user-head" />    <!-- include user's XSL HEAD processing here -->
      <xsl:call-template name="gen-user-scripts" /> <!-- include user's XSL javascripts here -->
      <xsl:call-template name="gen-user-styles" />  <!-- include user's XSL style element and content here -->
      <xsl:call-template name="processHDF"/>        <!-- Add user HDF file, if specified -->

<xsl:call-template name="generateProductMetadata"/>        <!-- Add Product metadata -->

</head>
    <xsl:value-of select="$newline"/>
  </xsl:template>

Then, again in your custom.xml, add the template you called:

  <xsl:template name="generateProductMetadata">
    <meta name="product" content="{@product}"/>
    <xsl:value-of select="$newline"/>
  </xsl:template>

This gives me the following result in a test run:

    <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="copyright" content="(C) Copyright 2005"/>
<meta name="DC.rights.owner" content="(C) Copyright 2005"/>
<meta name="DC.Type" content="topic"/>
<meta name="DC.Title" content="Technical data"/>
<meta name="DC.Relation" scheme="URI" content="18014398553839499_Technical_description.html"/>
<meta name="DC.Creator" content="Administrator"/>
<meta name="DC.Contributor" content="Administrator"/>
<meta name="DC.Date.Created" content="2013-03-05T11:13:04"/>
<meta name="DC.Date.Modified" content="2012-12-17T11:11:02"/>
<meta name="class" content="InfoType04"/>
<meta name="wf-state" content="NotReleased"/>
<meta name="DC.Format" content="XHTML"/>
<meta name="DC.Identifier" content="topic18014398553854475"/>
<meta name="DC.Language" content="en"/>
<link rel="stylesheet" type="text/css" href="commonltr.css"/>
<title>Technical data</title>
<meta name="product" content="product1"/>
</head>

Is that what you're looking for?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top