Skip to main content

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

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>

In the xslt-template for the recordlist (<xsl:template match="r:RecordList">) i have right now the following code:
<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/r:V">
          <xsl:value-of select="."/>
        </xsl:for-each>
    </xsl:when>
    <xsl:otherwise>...</xsl:otherwise>
  </xsl:choose>
</xsl:for-each>

Instead of the second for-each clause i need a distinction between the output of the normal value (r:L/r:V) and the value of the (optional) annotation. I have never worked with xslt but my concept looks like this:

<xsl:for-each select="r:L">
  <xsl:choose>
    <xsl:when test="$$has an Annotation$$">
      <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>

Has someone an idea/tip or in best case a solution ;) ?

Kind regards,

UniHi_Stud





Back to the top