Forum How do I...?

Different values for citation in text?

acebal
Hello:

I'm writing my PhD in HTML using PrinceXML for formatting it, and I don't know if it's possible to do the following:

When using Chicago style for citations, you have two options for citing sources in the text:


    As Doyle (2002) has stated, blah, blah, blah...
    Blah, blah, blah... (Doyle 2002)

How could I use cross references to choose between one style or another? Now I'm using the following markup for references:

<dt id="doyle2002">Doyle 2002</dt>


And I would like to be able to choose the style within the text with the following markup:


    <a class="ref" href="#doyle2002"></a>
    to generate (Doyle 2002)
    <a class="ref year" href="#doyle2002"></a>
    to generate (2002)

I've thought the following two options to do what I want:

<dt id="doyle2002">Doyle <span class="year">2002</span></dt>

<dt id="doyle2002" title="2002">Doyle 2002</dt>


And then selecting a different content depending on whether the reference has a class year or not, but I don't know if this can be done with target-text (selecting the content of a descendant of the target or the value of an attribute on the target? If not, do you have any suggestion?

Thanks!
mikeday
The target-content() value will always grab all of the text in the element and cannot grab attributes, so the only way to do this in CSS would be to have two separate IDs for each cross-reference, one specifically for the year. Alternatively, you could preprocess the input file with XSLT or Python or another scripting language to resolve the cross-references.
StoneCypher
a.ref { content: "(" target-content(href, year) ")"; }
a.ref.year { content: "(" target-content(href, author), " " target-content(href, year) ")" }

<dt author="Doyle" year="2002"/>

Actually, I'd prefer to hook the choice style on the container, as so:

<body class="chicagostyle">
<dt author="Doyle" year="2002" title="On The Seeming Of Consequence" publisher="Harcourt and Brace" location="New York"/>
</body>

.chicagostyle a.ref { content: "(" target-content(href, year) ")"; }
.mlastyle a.ref { content: "(" target-content(href, author), " " target-content(href, year) ")" }
.turabianstyle a.ref { content: "[" target-content(href, author) ", <i>" target-content(href, title) "</i>, (" target-content(href, location) ", " target-content(href, publisher) ", " target-content(href, year) ") ]" }

John Haugeland is http://fullof.bs/

StoneCypher
Lovely, phpBB doesn't know about the bahamas TLD.

John Haugeland is http://fullof.bs/