for each ENTITY
så er jeg kommet så langt med min kode og det virker. men nu vi jeg vide hvordan jeg for kørt alle mine entity igenmmen funktionen: "replace-string" ?<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [
<!ENTITY oelig "&oslash;" >
<!ENTITY aelig "&aelig;" >
<!ENTITY aalig "&aring;" >
<!ENTITY oolig "&Ouml;" >
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:library="urn:Framecoders.Library" exclude-result-prefixes="library">
<xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<xsl:variable name="query" select="library:Request('query')" />
<!-- reusable replace-string function -->
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="from"/>
<xsl:param name="to"/>
<xsl:choose>
<xsl:when test="contains($text, $from)">
<xsl:variable name="before" select="substring-before($text, $from)"/>
<xsl:variable name="after" select="substring-after($text, $from)"/>
<xsl:variable name="prefix" select="concat($before, $to)"/>
<xsl:value-of select="$before"/>
<xsl:value-of select="$to"/>
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$after"/>
<xsl:with-param name="from" select="$from"/>
<xsl:with-param name="to" select="$to"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/">
<form method="post" action="{library:FriendlyUrl($currentPage/@ID)}">
<p>
<label>
Søgeord:<br />
<input type="text" name="query" value="{$query}" />
</label>
</p>
<p>
<input type="submit" value="Søg" />
</p>
</form>
<xsl:if test="$query != ''">
<xsl:variable name="newQuery1">
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$query" />
<xsl:with-param name="from" select="'ø'" />
<xsl:with-param name="to" select="'œ'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="newQuery2">
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$newQuery1" />
<xsl:with-param name="from" select="'å'" />
<xsl:with-param name="to" select="'&aalig;'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="newQuery3">
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$newQuery2" />
<xsl:with-param name="from" select="'æ'" />
<xsl:with-param name="to" select="'æ'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="result" select="$currentPage/ancestor::root/descendant::node[contains(library:Lowercase(data[@key='pageContent']), library:Lowercase($newQuery3))]"/>
<h2>Søgeresultater</h2>
<p>
Der blev fundet <strong>
<xsl:value-of select="count($result)"/>
</strong> resultater.
</p>
<ul>
<xsl:for-each select="$result">
<li>
<a href="{library:FriendlyUrl(@ID)}">
<xsl:value-of select="@name"/>
</a><br/>
Senest opdateret <xsl:value-of select="concat(library:FormatDate(@lastModified, 'd. MMMM yyyy'),' kl. ',library:FormatDate(@lastModified, 't'))" />
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>