Editing Image List report

Robby Stephenson robby at periapsis.org
Fri Sep 8 18:48:37 MDT 2006


On Friday 08 September 2006 5:21, Marcus wrote:
> How do I change the code to show comments, but not plot?
>
> <!-- add all paragraph fields, too -->
>      <xsl:for-each select="../tc:fields/tc:field[@type = 2]">
>       <xsl:call-template name="field-output">
>        <xsl:with-param name="entry" select="$entry"/>
>        <xsl:with-param name="field" select="plot"/>
> 	</xsl:call-template>
>      </xsl:for-each>

It's rather convoluted, I know. First, you have to use the tc namespace to 
reference Tellico elements. Second, you have to know how to reference each 
field, which is usally by matching on the field name, and you have to 
remember the correct XPath for the field elements. Try this:

<xsl:call-template name="field-output">
 <xsl:with-param name="entry" select="$entry"/>
 <xsl:with-param name="field" select="../tc:fields/tc:field[@name 
= 'comments'"/>
</xsl:call-template>

The for-each loop isn't needed then.

> I've used HTML templates in Perl before so this can't be that different.
> Is there a tutorial somewhere on how to edit/create reports?

Not really. You need a good understanding of XSL, but I haven't written up 
anything about writing or modifying reports. Export a Tellico XML file and 
look in there to get a feel for the structure.

> (Btw, are paragraph-type fields ones wrapped in <p>...</p>? Or how/where
> is this defined?)

The Image List has a template named "field-output" that handles booleans and 
URLs. Other fields get passed on to the "simple-field-value" template in 
the tellico-common.xsl file, which just outputs the value. So, no, they 
aren't wrapped in <p> elements.

To do that, you could add the following to Image_List.xsl, down around line 
227, after the check for URL type.

<xsl:when test="$field/@type=2">
 <p>
  <xsl:value-of select="$entry/*[local-name() = $field/@name]"/>
 </p>
</xsl:when>

Paragraphs are type = 2. That will add the <p> tags.

Robby



More information about the tellico-users mailing list