Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [smila-user] Access to data model in XSLT result page

Hi Oliver,

Am Donnerstag, den 30.12.2010, 00:41 +0100 schrieb "Oliver Schäfer":
> Hello,
> I have a question concerning the access to a path of a record in the XSLT stylesheet for the search-result-page.
> Actually I have the following record-structure:
> <A>
>   <L>
>     <V>...</V>
>     <An n="adaption">
>       <V>...</V>
>     </An>
>   </L>
>   <L>
>     <V>...</V>
>   </L>
>   <L>
>     <V>...</V>
>   </L>
> </A>
> [...]
> Has someone an idea/tip or in best case a solution ;) ?

Without having tested it (and I'm not an XSL expert myself) ... I think
something like this should work:

<xsl:for-each select="r:A[r:L/r:V]">
  <xsl:choose>
    <xsl:when test="@n='RecipeIngredient'">
      <li><tt><xsl:value-of select="@n"/>: </tt>

      <xsl:for-each select="r:L">
        <xsl:choose>
          <xsl:when test="r:An[@n='adaption']/r:V">
            <xsl:value-of select="r:An[@n='adaption']/r:V"
                  disable-output-escaping="yes"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="r:V"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>

    </xsl:when>
    <xsl:otherwise>...</xsl:otherwise>
  </xsl:choose>
</xsl:for-each>

This should print the content of the annotation value if one exists, or
the literal value itself otherwise.

Hope this helps,
Juergen.




Back to the top