OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

clr-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [clr-dev] Sample file of DDI controlled vocabularies


Hi Ken,

No problem at all.
Sorry, now I'm slow in responding.

Thanks a lot for your answer and for your particular comments on the 
sample file. This is very helpful. Good to know that we are on the right 
track.

Regarding the embedded HTML documentation:
The namespace "http://www.w3.org/1999/xhtml"; is used. The used HTML tags 
could be just passed through by a stylesheet.

I had a short look at the stylesheet you mentioned. The HTML tags seem 
to be stripped off, just the content is copied. This seems to be the 
reason that the rendering of the embedded documentation of the DDI CV 
Genericode file is not working. I applied the stylesheet also to 
UBL-CodeList-LanguageClassificationCode-v1-0.xml and looked at the 
output. The used HTML tag "p" for the content "Genericode list for ISO 
639-2 written language codes ... " is also stripped.

Attached is a draft version of a stylesheet, which is specific to the 
DDI CV Genericode files. The HTML nodes are just copied without the 
namespace prefix.

I'll inform you, when the DDI controlled vocabularies are publicly 
available.

Cheers,
Achim

On 04.04.2011 02:41, G. Ken Holman wrote:
> Please forgive my absence from the list, Joachim, as I was on an
> extended vacation escaping the cold Canadian winter.
>
> At 2011-03-24 16:33 +0100, Joachim Wackerow wrote:
>> The DDI Alliance is working on controlled vocabularies (CVs) which
>> support the DDI specification. The CVs are realized in Genericode. We
>> plan to publish the first set of CVs soon.
>
> Congratulations!
>
>> The Data Documentation Initiative (DDI) is an effort to create an
>> international standard for describing data from the social,
>> behavioral, and economic sciences. Further information is available at:
>> http://www.ddialliance.org/
>>
>> Attached is a sample CV in Genericode. I tried to build the structure
>> according to the documentation of Genericode and according to earlier
>> valuable comments of Tony and Ken. I would be interested in feedback
>> on how Genericode is used for this purpose.
>
> Using your file for test I will have to revisit my formatting
> stylesheets found at:
>
> http://www.CraneSoftwrights.com/resources/ubl/index.htm#codelist
>
> By personal inspection it looks to me like what you are doing for
> embedding HTML documentation is perfectly okay ... yet the rendered
> result is not working ... thus the need for me to find out where the
> disconnect is. What assumptions can I change in my stylesheets?
>
>> Hierarchies in the code values are indicated by the separator dot
>> (example: TimeSeries.Discrete). A fixed amount of columns is
>> preferred. Therefore the hierarchical values are not in separate
>> columns. The hierarchy depth is not known for future CVs.
>
> The values could not be in separate columns without combining the
> columns to form the unique key ... I think what you are doing with the
> "." is just fine, if you think your users will not have a problem with it.
>
> As a committee we are not advising on what you use as code values, only
> how you publish them for machine-readability.
>
>> Multiple languages in a description column are realized by a complex
>> value (currently only one language included).
>
> That looks just fine. I do the same thing with the UBL IDD files in
> genericode. I like that you are verbose for your community of users to
> read the details.
>
>> Additional documentation sections are included in Annotation using
>> HTML div elements with a class attribute. An application can recognize
>> the required section by the value of the class attribute.
>> Application-specific information is provided in key/value pairs in the
>> AppInfo.
>
> Kewl!
>
>> I would appreciate any comments on the sample file.
>
> I like what you've done with your document. When I can make the time to
> check out why my HTML stylesheets are not detecting your embedded HTML,
> I'll post again to the list.
>
> Thank you for sharing your work in this code list community! Good luck
> on your project.
>
> . . . . . . . . . . Ken
>
> --
> Contact us for world-wide XML consulting & instructor-led training
> Crane Softwrights Ltd. http://www.CraneSoftwrights.com/c/
> G. Ken Holman mailto:gkholman@CraneSoftwrights.com
> Legal business disclaimers: http://www.CraneSoftwrights.com/legal
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: clr-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: clr-dev-help@lists.oasis-open.org


-- 
GESIS - Leibniz Institute for the Social Sciences
Department: Monitoring Society and Social Change
Unit: Social Science Metadata Standards
Visiting address: B2 1, 68159 Mannheim, Germany
Postal address: P.O. Box 122155, 68072 Mannheim, Germany
Phone: +49 (0)621 1246 262
Fax: +49 (0)621 1246 100
E-mail: joachim.wackerow@gesis.org
www.gesis.org/en/institute/
<?xml version="1.0" encoding="UTF-8"?>
<!--

gc2html.xslt

XSLT stylesheet for generating HTML files on the basis of files according to Genericode 1.0 DDICV profile 1.0.

joachim.wackerow@gesis.org
2011-03-14

-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:gc="http://docs.oasis-open.org/codelist/ns/genericode/1.0/"; xmlns:ddicv="urn:ddicv" xmlns="http://www.w3.org/1999/xhtml"; xmlns:h="http://www.w3.org/1999/xhtml"; xmlns:xalan="http://xml.apache.org/xalan"; exclude-result-prefixes="ddicv gc h xalan">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:variable name="DefaultLanguage" select=" 'en-US' "/>
	<xsl:param name="Language" select=" $DefaultLanguage "/>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:variable name="Value" select="/gc:CodeList/Annotation/AppInfo/ddicv:Value"/>
	<xsl:variable name="CopyrightText" select="$Value[ @key='CopyrightText' ]"/>
	<xsl:variable name="CopyrightOwner" select="$Value[ @key='CopyrightOwner' ]"/>
	<xsl:variable name="CopyrightOwnerURL" select="$Value[ @key='CopyrightOwnerURL' ]"/>
	<xsl:variable name="CopyrightYear" select="$Value[ @key='CopyrightYear' ]"/>
	<xsl:variable name="LicenseName" select="$Value[ @key='LicenseName' ]"/>
	<xsl:variable name="LicenseURL" select="$Value[ @key='LicenseURL' ]"/>
	<xsl:variable name="NonBreakingSpace" select=" '&#160;' "/>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:key name="ColumnRef" match="/gc:CodeList/SimpleCodeList/Row/Value" use="@ColumnRef"/>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="*">
		<xsl:element name="{local-name()}">
			<xsl:apply-templates select="@* | node()"/>
		</xsl:element>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="@*">
		<xsl:copy>
			<xsl:apply-templates select="@*"/>
		</xsl:copy>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="/">
		<xsl:apply-templates select="gc:CodeList"/>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="gc:CodeList">
		<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="{$Language}">
			<head>
				<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
				<title>
					<xsl:call-template name="Title"/>
				</title>
				<xsl:call-template name="Style"/>
			</head>
			<body>
				<xsl:call-template name="PageHeader"/>
				<hr/>
				<div class="CodeList">
					<table>
						<caption>Code List</caption>
						<thead>
							<tr>
								<xsl:apply-templates select="ColumnSet/Column" mode="Description"/>
							</tr>
						</thead>
						<tbody>
							<xsl:apply-templates select="SimpleCodeList/Row">
								<xsl:with-param name="ColumnSetNode" select="ColumnSet"/>
							</xsl:apply-templates>
						</tbody>
					</table>
				</div>
				<xsl:call-template name="Usage"/>
				<xsl:call-template name="PageFooter"/>
			</body>
		</html>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template name="PageHeader">
		<div>
			<h1>
				<xsl:call-template name="Title"/>
			</h1>
			<hr/>
			<h2>Description</h2>
			<xsl:call-template name="LanguageSelectorText">
				<xsl:with-param name="Node" select="Annotation/Description/h:div[ @class='Description' ]"/>
			</xsl:call-template>
			<xsl:apply-templates select="Annotation/Description/h:div[ @class='Description' ]" mode="Language">
				<xsl:sort select="@xml:lang"/>
			</xsl:apply-templates>
			<hr/>
			<h2>Details</h2>
			<dl>
				<dt>
					<xsl:text>Long Name:</xsl:text>
				</dt>
				<dd>
					<xsl:call-template name="LanguageSelectorText">
						<xsl:with-param name="Node" select="Identification/LongName"/>
					</xsl:call-template>
					<xsl:apply-templates select="Identification/LongName" mode="Language">
						<xsl:sort select="@xml:lang"/>
						<xsl:with-param name="Separator" select=" ', ' "/>
					</xsl:apply-templates>
				</dd>
				<dt>
					<xsl:text>Short Name:</xsl:text>
				</dt>
				<dd>
					<xsl:value-of select="Identification/ShortName"/>
				</dd>
				<dt>
					<xsl:text>Version:</xsl:text>
				</dt>
				<dd>
					<xsl:value-of select="Identification/Version"/>
				</dd>
				<dt>
					<xsl:text>Canonical URI:</xsl:text>
				</dt>
				<dd>
					<xsl:value-of select="Identification/CanonicalUri"/>
				</dd>
				<dt>
					<xsl:text>Canonical URI of this version:</xsl:text>
				</dt>
				<dd>
					<xsl:value-of select="Identification/CanonicalVersionUri"/>
				</dd>
				<xsl:apply-templates select="Identification/LocationUri"/>
				<xsl:apply-templates select="Identification/AlternateFormatLocationUri"/>
				<dt>
					<xsl:text>Agency Name: </xsl:text>
				</dt>
				<dd>
					<a href="{$CopyrightOwnerURL}">
						<xsl:value-of select="Identification/Agency/ShortName"/>
					</a>
				</dd>
			</dl>
		</div>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template name="Title">
		<xsl:text>DDI Controlled Vocabulary for </xsl:text>
		<xsl:call-template name="LanguageSelectorText">
			<xsl:with-param name="Node" select="Identification/LongName"/>
		</xsl:call-template>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template name="Style">
		<style type="text/css">
			<xsl:text disable-output-escaping="yes"><![CDATA[

body {
  margin: 2em;
  /*
  font-size: 90%;
  */
}
h2, caption {
  font-size: 130%;
}
div.UsageTitle {
  font-size: 110%;
  font-weight: bold;
}
hr {
  clear: left;
  color: #D3D3D3; /*lightgrey */
  margin-top: 2em;
  margin-bottom: 2em;
  margin-left: 10%;
  margin-right: 10%;
}
table, th, td {
  border-style: solid;
  border-color: #D3D3D3; /*lightgrey */
  border-width: 1px;
  border-collapse: collapse;
}
caption {
  font-weight: bold;
  margin-bottom: 1em;
  text-align: left;
}
thead {
  font-size: 120%;
}
th, td {
  padding: 0.5em;
  vertical-align: top;
}
td.Code {
  font-weight: bold;
}
td.Term {
  white-space: nowrap;
}
dl {
  float: left;
}
dt {
  clear: left;
  float: left;
  font-weight: bold;
  width: 15em;
  margin-bottom: 0.3em;
  margin-right: 1em;
}
dd {
  float: left;
  margin: 0;
  margin-bottom: 0.3em;
}
span.LanguageCode{
  color:#C0C0C0; /* silver */
}
table.UsageDetails>thead>tr>th {
  width: 15em;
}
.CodeList, .Usage {
  page-break-before:always;
}

]]></xsl:text>
		</style>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="LocationUri">
		<dt>
			<xsl:text>Location URI:</xsl:text>
		</dt>
		<dd>
			<a>
				<xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
				<xsl:value-of select="."/>
			</a>
		</dd>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="AlternateFormatLocationUri">
		<dt>
			<xsl:text>Alternate format location URI:</xsl:text>
		</dt>
		<dd>
			<a>
				<xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute>
				<xsl:value-of select="."/>
			</a>
		</dd>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="Column" mode="Description">
		<th>
			<xsl:value-of select="LongName"/>
		</th>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="Column" mode="Content">
		<xsl:param name="RowNode"/>
		<xsl:variable name="ColumnId" select="@Id"/>
		<xsl:variable name="Class" select="ShortName"/>
		<td class="{$Class}">
			<xsl:choose>
				<!-- if cell exists -->
				<xsl:when test="$RowNode/Value[ @ColumnRef = $ColumnId ]">
					<xsl:for-each select="$RowNode/Value[ @ColumnRef = $ColumnId ]">
						<xsl:choose>
							<xsl:when test="SimpleValue">
								<xsl:value-of select="SimpleValue"/>
							</xsl:when>
							<xsl:when test="ComplexValue">
								<xsl:call-template name="LanguageSelectorText">
									<xsl:with-param name="Node" select="ComplexValue/ddicv:Value"/>
								</xsl:call-template>
								<xsl:apply-templates select="ComplexValue/ddicv:Value" mode="Language">
									<xsl:sort select="@xml:lang"/>
								</xsl:apply-templates>
							</xsl:when>
						</xsl:choose>
					</xsl:for-each>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>-</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</td>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="Row">
		<xsl:param name="ColumnSetNode"/>
		<xsl:variable name="RowNode" select="."/>
		<tr>
			<xsl:for-each select="$ColumnSetNode">
				<xsl:apply-templates select="Column" mode="Content">
					<xsl:with-param name="RowNode" select="$RowNode"/>
				</xsl:apply-templates>
			</xsl:for-each>
		</tr>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template name="Usage">
		<hr/>
		<div class="Usage">
			<h2>Usage</h2>
			<xsl:apply-templates select="Annotation/Description/h:div[ @class='Usage' ]/*"/>
		</div>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template name="PageFooter">
		<hr/>
		<h2>Copyright and License</h2>
		<p>
			<xsl:value-of select="$CopyrightText"/>
			<xsl:text> </xsl:text>
			<a href="{$CopyrightOwnerURL}">
				<xsl:value-of select="$CopyrightOwner"/>
			</a>
			<xsl:text> </xsl:text>
			<xsl:value-of select="$CopyrightYear"/>
			<xsl:text>.</xsl:text>
		</p>
		<p>
			<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/";>
				<img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"/>
			</a>
			<xsl:value-of select="$NonBreakingSpace"/>
			<xsl:value-of select="$NonBreakingSpace"/>
			<span>This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/";>Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.</span>
		</p>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template name="LanguageSelectorText">
		<xsl:param name="Node"/>
		<xsl:choose>
			<xsl:when test="$Node[ lang( $Language ) ]">
				<xsl:value-of select="$Node[ lang( $Language ) ]"/>
			</xsl:when>
			<xsl:when test="$Node[ lang( $Language ) ]">
				<xsl:value-of select="$Node[ lang( $DefaultLanguage ) ]"/>
			</xsl:when>
			<xsl:when test="$Node[ lang( 'en' ) ]">
				<xsl:value-of select="$Node[ lang( 'en' ) ]"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$Node[ not( @xml:lang ) ]"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template name="LanguageSelectorNode">
		<xsl:param name="Node"/>
		<xsl:choose>
			<xsl:when test="$Node[ lang( $Language ) ]">
				<xsl:apply-templates select="$Node[ lang( $Language ) ]"/>
			</xsl:when>
			<xsl:when test="$Node[ lang( $Language ) ]">
				<xsl:apply-templates select="$Node[ lang( $DefaultLanguage ) ]"/>
			</xsl:when>
			<xsl:when test="$Node[ lang( 'en' ) ]">
				<xsl:apply-templates select="$Node[ lang( 'en' ) ]"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="$Node[ not( @xml:lang ) ]"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
	<xsl:template match="node()" mode="Language">
		<xsl:param name="Separator" select=" 'Newline' "/>
		<xsl:if test=" @xml:lang != $DefaultLanguage ">
			<xsl:choose>
				<xsl:when test=" $Separator = 'Newline' ">
					<br/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$Separator"/>
				</xsl:otherwise>
			</xsl:choose>
			<span class="LanguageCode">
				<xsl:value-of select="@xml:lang"/>
				<xsl:text>: </xsl:text>
			</span>
			<xsl:value-of select="."/>
		</xsl:if>
	</xsl:template>
	<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</xsl:stylesheet>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]