Schwartz, Christine
2016-10-31 16:52:38 UTC
Hi,
I'm hoping someone on this list can clarify my conundrum.
I'm working with a colleague on a writing project and one of his examples uses this XPath syntax "./." in the starts-with() function within an XSLT stylesheet. I don't know what "./." means. I would think that "." alone would be sufficient to refer to the context node.
Here's the example:
<xsl:for-each select="//dim:field">
<xsl:if test="./@element='title'">
<xsl:choose>
<xsl:when test="starts-with(./.,'The ')">
<datafield tag="245" ind1="1" ind2="4">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
</xsl:when>
<xsl:when test="starts-with(./.,'An ')">
<datafield tag="245" ind1="1" ind2="3">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
</xsl:when>
<xsl:when test="starts-with(./.,'A ')">
<datafield tag="245" ind1="1" ind2="2">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
</xsl:when>
<xsl:otherwise>
<datafield tag="245" ind1="1" ind2="0">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
Thanks,
Chris
Christine Schwartz
Metadata Librarian and XML Database Administrator
Princeton Theological Seminary
Library
P.O. Box 821
Princeton, NJ 08542
***@ptsem.edu
(609) 497-7938
_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk
I'm hoping someone on this list can clarify my conundrum.
I'm working with a colleague on a writing project and one of his examples uses this XPath syntax "./." in the starts-with() function within an XSLT stylesheet. I don't know what "./." means. I would think that "." alone would be sufficient to refer to the context node.
Here's the example:
<xsl:for-each select="//dim:field">
<xsl:if test="./@element='title'">
<xsl:choose>
<xsl:when test="starts-with(./.,'The ')">
<datafield tag="245" ind1="1" ind2="4">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
</xsl:when>
<xsl:when test="starts-with(./.,'An ')">
<datafield tag="245" ind1="1" ind2="3">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
</xsl:when>
<xsl:when test="starts-with(./.,'A ')">
<datafield tag="245" ind1="1" ind2="2">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
</xsl:when>
<xsl:otherwise>
<datafield tag="245" ind1="1" ind2="0">
<subfield code="a"><xsl:value-of select="."/>.</subfield>
</datafield>
Thanks,
Chris
Christine Schwartz
Metadata Librarian and XML Database Administrator
Princeton Theological Seminary
Library
P.O. Box 821
Princeton, NJ 08542
***@ptsem.edu
(609) 497-7938
_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk