Revision: 1402
http://geonetwork.svn.sourceforge.net/geonetwork/?rev=1402&view=revAuthor: rdewit
Date: 2008-07-17 04:45:50 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
Rewrite of config file handling. Every node in xpath is processed so Add and Delete buttons are created appropriately.
Work in progress still.
Modified Paths:
--------------
sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-common.xsl
sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-header-footer.xsl
sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-instance.xsl
sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms.xsl
Modified: sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-common.xsl
===================================================================
--- sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-common.xsl 2008-07-17 02:03:48 UTC (rev 1401)
+++ sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-common.xsl 2008-07-17 04:45:50 UTC (rev 1402)
@@ -38,7 +38,8 @@
<xsl:template match="gmd:*|gco:*|gml:*">
<xsl:param name="counter" select="1"/>
- <xsl:param name="xpath" select="''"/>
+ <xsl:param name="xpath-todo" select="''"/>
+ <xsl:param name="xpath-done" select="''"/>
<xsl:param name="custom"/>
<xsl:variable name="doc" select="/"/>
@@ -65,8 +66,58 @@
<xsl:variable name="childPrefix" select="substring-before($childName, ':')"/>
<xsl:variable name="grandChildName" select="name(child::*)"/>
-
+ <xsl:variable name="path">
+ <xsl:choose>
+ <xsl:when test="starts-with($xpath-todo,'/')">
+ <xsl:value-of select="substring-after($xpath-todo,'/')"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$xpath-todo"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="first-element">
+ <xsl:if test="starts-with($xpath-todo,'/')">
+ <xsl:value-of select="'/'"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="contains($path, '/')">
+ <xsl:value-of select="substring-before($path,'/')"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="xpath-new-todo">
+ <xsl:choose>
+ <xsl:when test="contains($path, '/')">
+ <xsl:value-of select="substring-after($path,'/')"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="xpath-new-done">
+ <xsl:choose>
+ <xsl:when test="$xpath-done = ''">
+ <xsl:value-of select="$first-element"/>
+ </xsl:when>
+ <xsl:when test="$first-element = ''">
+ <xsl:value-of select="$xpath-done"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="concat($xpath-done,'/',$first-element)"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <!--
+ Xpath Done: <xsl:value-of select="$xpath-done"/>
+ Xpath Todo: <xsl:value-of select="$xpath-todo"/>
+
+ FirstNode: <xsl:value-of select="$first-element"/>
+ Xpath New Todo: <xsl:value-of select="$xpath-new-todo"/>
+ Xpath New Done: <xsl:value-of select="$xpath-new-done"/>
+ .
+ -->
+
<!--
PARENT: <xsl:value-of select="name(..)"/><xh:br />
ELEMENT: <xsl:value-of select="name()"/><xh:br />
@@ -86,6 +137,17 @@
Ignoring
-->
</xsl:when>
+
+ <!--
+ <xsl:when test="$xpath-todo and $xpath-todo != ''">
+
+ <xsl:apply-templates select="saxon:evaluate($first-element)">
+ <xsl:with-param name="xpath-done" select="concat($xpath-done,'/',$first-element)"/>
+ <xsl:with-param name="xpath-todo" select="$xpath-todo"/>
+ </xsl:apply-templates>
+
+ </xsl:when>
+ -->
<!-- Test if this is an unmarked codelist -->
<!--
@@ -128,23 +190,13 @@
</xsl:choose>
</xsl:variable>
-<!--
-<xsl:if test="geonet:child[@name='geographicElement']">
-<xh:p>complex node: <xsl:copy-of select="$childLocalName"/> : <xsl:value-of select="count(geonet:child[@name='geographicElement']/*)"/> <xsl:value-of select="$childname"/></xh:p>
-</xsl:if>
- -->
-<!--
- <xsl:choose>
- <xsl:when test="geonet:child"
- -->
-
+ <xf:group ref=".">
<xf:repeat nodeset="{name()}|geonet:child[@name='{$childLocalName}' and @prefix='{$childPrefix}' and not (../*[name() = '{$childName}'])]"
class="complex node gmd:*"
id="{$repeat-id}"
- number="1"
>
- <xsl:if test="$parentName != '/'">
+ <xsl:if test="$xpath-todo = '' and $parentName != '/'">
<xsl:variable name="childLocalName" select="substring-after($childName,':')"/>
<xsl:variable name="childPrefix" select="substring-before($childName,':')"/>
@@ -152,7 +204,7 @@
<!-- delete button -->
<xf:group ref=".[count(../{$childName}) > {$minVal}]">
<xf:trigger>
- <xf:label>Delete <xf:output value="instance('labels')/element[@name='{name()}']/label"/> below</xf:label>
+ <xf:label>Delete <xf:output value="instance('labels')/element[@name='{name()}']/label"/> below (<xsl:value-of select="$childName"/>)</xf:label>
<xf:action ev:event="DOMActivate">
<!--
<xf:insert context=".." nodeset="{$childName}" at="index('{name(../..)}/{$childName}')" position="after" origin="instance('snippets')/snippet[@id = '{$parentName}']//geonet:child[@name='{$childLocalName}' and @prefix='{$childPrefix}']"/>
@@ -177,7 +229,7 @@
<xf:group ref=".">
<xsl:choose>
- <xsl:when test="$custom and $custom[@type = 'meta']">
+ <xsl:when test="$xpath-todo != ''">
<xsl:attribute name="class" select="'gn-subgroup'"/>
<xf:label class="subgroup-label"/>
</xsl:when>
@@ -187,15 +239,31 @@
</xsl:otherwise>
</xsl:choose>
- <xf:repeat nodeset=".">
<xsl:choose>
+ <xsl:when test="$xpath-todo != ''">
+ <!--
+ Custom and xpath-todo:
+ todo: <xsl:value-of select="$xpath-todo"/>
+ done: <xsl:value-of select="$xpath-done"/>
+ saxon: <xsl:value-of select="concat($xpath-done,'/',$first-element)"/>
+ -->
+ <xsl:apply-templates select="saxon:evaluate(concat($xpath-done,'/',$first-element))">
+ <xsl:with-param name="counter" select="concat($counter,'-',position())"/>
+ <xsl:with-param name="xpath-done" select="$xpath-new-done"/>
+ <xsl:with-param name="xpath-todo" select="$xpath-new-todo"/>
+ <xsl:with-param name="custom" select="$custom"/>
+ </xsl:apply-templates>
+
+ </xsl:when>
+
<xsl:when test="$custom">
<xsl:variable name="xpath2" select="$custom/@xpath"/>
<xsl:for-each select="$custom/*">
<xsl:apply-templates select=".">
<xsl:with-param name="counter" select="concat($counter,'-',position())"/>
<xsl:with-param name="doc" select="$doc"/>
- <xsl:with-param name="xpath" select="$xpath"/>
+ <xsl:with-param name="xpath-done" select="$xpath-new-done"/>
+ <xsl:with-param name="xpath-todo" select="$xpath-new-todo"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
@@ -205,9 +273,9 @@
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
- </xf:repeat>
</xf:group>
</xf:repeat>
+ </xf:group>
<!-- Child node is a complex node with choose elements => select to choose exactly one element -->
<xsl:choose>
@@ -241,13 +309,19 @@
<xh:p>
<xf:group ref="." class="gn-subgroup">
<xsl:choose>
+
+ <xsl:when test="$custom and $xpath-todo != ''">
+ <xsl:apply-templates select="saxon:evaluate($first-element)">
+ <xsl:with-param name="xpath-done" select="$xpath-new-done"/>
+ <xsl:with-param name="xpath-todo" select="$xpath-new-todo"/>
+ </xsl:apply-templates>
+ </xsl:when>
<xsl:when test="$custom">
<xsl:for-each select="$custom/*">
- <xsl:variable name="xpath" select="$custom/@xpath"/>
+ <xsl:variable name="xpath-todo" select="$custom/@xpath"/>
<xsl:apply-templates select=".">
<xsl:with-param name="counter" select="$counter"/>
<xsl:with-param name="doc" select="$doc"/>
- <xsl:with-param name="xpath" select="$xpath"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:when>
@@ -629,7 +703,7 @@
<xsl:otherwise>
<xf:input ref="{name()}">
<xsl:if test="name() = 'gco:Date'">
- <xsl:attribute name="xxforms:format">if (. castable as xs:date) then format-date(xs:date(.), '[Y]-[M]-[D]', 'en', (), ()) else .</xsl:attribute>
+ <xsl:attribute name="xxforms:format">if (. castable as xs:date) then format-date(xs:date(.), '[Y0001]-[M01]-[D01]', '<xsl:value-of select="$language"/>', (), ()) else .</xsl:attribute>
</xsl:if>
<xf:label ref="instance('labels')/element[@name='{$parentName}']/label" class="input-label"/>
<xf:hint ref="instance('labels')/element[@name='{$parentName}']/description"/>
Modified: sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-header-footer.xsl
===================================================================
--- sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-header-footer.xsl 2008-07-17 02:03:48 UTC (rev 1401)
+++ sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-header-footer.xsl 2008-07-17 04:45:50 UTC (rev 1402)
@@ -138,7 +138,7 @@
<xf:instance id="full" src="
http://localhost/xforms/instance-minimal.xml"/>
<xf:instance id="full" src="
http://localhost/xforms/instance-minimal.xml"/>
-->
- <xf:instance id="full" src="{$geonetwork-location}/srv/{$loc}/xml.metadocument.instance?uuid={$uuid}"/>
+ <xf:instance id="full" src="{$geonetwork-location}/srv/{$language}/xml.metadocument.instance?uuid={$uuid}"/>
<xf:instance id="template-characterstring">
<gco:CharacterString>Test
@@ -272,9 +272,9 @@
<xforms:action ev:event="xforms-submit" ev:observer="submit-full" >
<xf:delete nodeset="instance('geonetwork-errors')/*"/>
<xf:delete nodeset="instance('geonetwork-infos')/*"/>
- <xf:setvalue ref="instance('geonetwork-request-update')/version" value=". + 1"/>
</xforms:action>
<xf:action ev:event="xforms-submit-done" ev:observer="submit-full">
+ <xf:setvalue ref="instance('geonetwork-request-update')/version" value=". + 1"/>
<xf:insert context="instance('geonetwork-infos')" nodeset="//mesage[@id='saved']" origin="instance('geonetwork-info-messages')"/>
</xf:action>
<xf:action ev:event="xforms-submit-error" ev:observer="submit-full">
@@ -346,6 +346,12 @@
<xf:delete nodeset="instance('geonetwork-request-update')/data//geonet:child"/>
</xf:action>
</xf:submit>
+
+ <xh:p>
+ <xf:input ref="instance('geonetwork-request-update')/version">
+ <xf:label class="input-label">version</xf:label>
+ </xf:input>
+ </xh:p>
<xh:div class="gn-group">
<xh:span class="group-label">Snippet Service</xh:span>
@@ -436,8 +442,8 @@
-->
<!--
+ -->
<widget:xforms-instance-inspector xmlns:widget="
http://orbeon.org/oxf/xml/widget"/>
- -->
</xh:body>
</xhtml:html>
Modified: sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-instance.xsl
===================================================================
--- sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-instance.xsl 2008-07-17 02:03:48 UTC (rev 1401)
+++ sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms-instance.xsl 2008-07-17 04:45:50 UTC (rev 1402)
@@ -21,9 +21,9 @@
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
-<xsl:template match="*|@*|text()">
+<xsl:template match="*|@*">
<xsl:copy>
- <xsl:apply-templates select="*|@*|text()"/>
+ <xsl:apply-templates select="*|@*"/>
</xsl:copy>
</xsl:template>
Modified: sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms.xsl
===================================================================
--- sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms.xsl 2008-07-17 02:03:48 UTC (rev 1401)
+++ sandbox/geonetworkui/BlueNetMEST/web/geonetwork/xsl/conversion/export/xml_xforms.xsl 2008-07-17 04:45:50 UTC (rev 1402)
@@ -22,11 +22,11 @@
<xsl:param name="geonetwork-location" select="concat('
http://',/root/gui/env/server/host,':',/root/gui/env/server/port,/root/gui/url)"/>
<xsl:param name="uuid"/>
<xsl:param name="schema" select="'iso19139'"/>
-<xsl:param name="loc" select="'en'"/>
+<xsl:param name="language" select="if (/root/gui/strings/language and /root/gui/strings/language !='') then /root/gui/strings/language else 'en'"/>
<xsl:param name="config" select="concat($geonetwork-location,'/xml/xforms/config-brs.xml')"/>
<xsl:param name="template" select="concat($geonetwork-location,'/xml/xforms/template-brs.xml')"/>
-<xsl:param name="labels" select="concat($geonetwork-location,'/xml/schemas/',$schema,'/loc/',$loc,'/labels.xml')"/>
-<xsl:param name="codelists" select="concat($geonetwork-location,'/xml/schemas/',$schema,'/loc/',$loc,'/codelists.xml')"/>
+<xsl:param name="labels" select="concat($geonetwork-location,'/xml/schemas/',$schema,'/loc/',$language,'/labels.xml')"/>
+<xsl:param name="codelists" select="concat($geonetwork-location,'/xml/schemas/',$schema,'/loc/',$language,'/codelists.xml')"/>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:include href="xml_xforms-common.xsl"/>
@@ -93,6 +93,119 @@
</xsl:template>
<xsl:template match="group|item">
+ <xsl:param name="counter" select="position()" />
+ <xsl:param name="doc"/>
+ <xsl:param name="xpath-done" select="''"/>
+
+ <xsl:variable name="position" select="position()"/>
+
+ <xsl:variable name="xpath-todo" select="@xpath"/>
+
+ <xsl:variable name="path">
+ <xsl:choose>
+ <xsl:when test="starts-with($xpath-todo,'/')">
+ <xsl:value-of select="substring-after($xpath-todo,'/')"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$xpath-todo"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="first-element">
+ <xsl:if test="starts-with($xpath-todo,'/')">
+ <xsl:value-of select="'/'"/>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="contains($path, '/')">
+ <xsl:value-of select="substring-before($path,'/')"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$path"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="xpath-new-todo">
+ <xsl:choose>
+ <xsl:when test="contains($path, '/')">
+ <xsl:value-of select="substring-after($path,'/')"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="xpath-new-done" select="concat($xpath-done,'/',$first-element)"/>
+
+ <xsl:variable name="xpath-new-done">
+ <xsl:choose>
+ <xsl:when test="$xpath-done = ''">
+ <xsl:value-of select="$first-element"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="concat($xpath-done,'/',$first-element)"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+
+ <!--
+ Xpath Done: <xsl:value-of select="$xpath-done"/>
+ Xpath Todo: <xsl:value-of select="$xpath-todo"/>
+
+ FirstNode: <xsl:value-of select="$first-element"/>
+ Xpath New Todo: <xsl:value-of select="$xpath-new-todo"/>
+ Xpath New Done: <xsl:value-of select="$xpath-new-done"/>
+
+ Saxon evaluate: <xsl:value-of select="concat($xpath-done,'/',$first-element)"/>
+ -->
+
+ <xsl:variable name="xpath_evaluate">
+ <xsl:choose>
+ <xsl:when test="$xpath-done = ''">
+ <xsl:value-of select="$first-element"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="''"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:variable name="config" select="."/>
+
+ <xsl:variable name="basename_xpath_done">
+ <xsl:call-template name="basename">
+ <xsl:with-param name="path" select="$xpath-done"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!--
+ <xf:group ref="{$basename_xpath_done}" class="from customise ({name()})">
+ -->
+ <xsl:variable name="name" select="name()"/>
+
+ <xsl:if test="$doc">
+ <xsl:for-each select="$doc">
+ <xsl:choose>
+ <!-- group -->
+ <xsl:when test="$name != 'item'">
+ <xsl:apply-templates select="saxon:evaluate(concat($xpath-done,'/',$first-element))">
+ <xsl:with-param name="counter" select="concat($counter,'-', $position)"/>
+ <xsl:with-param name="xpath-done" select="$xpath-new-done"/>
+ <xsl:with-param name="xpath-todo" select="$xpath-new-todo"/>
+ <xsl:with-param name="custom" select="$config"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <!-- item -->
+ <xsl:otherwise>
+ <xsl:apply-templates select="saxon:evaluate(concat($xpath-done,'/',$first-element))">
+ <xsl:with-param name="counter" select="concat($counter,'-', $position)"/>
+ <xsl:with-param name="xpath-done" select="$xpath-new-done"/>
+ <xsl:with-param name="xpath-todo" select="$xpath-new-todo"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:if>
+ <!--
+ </xf:group>
+ -->
+
+</xsl:template>
+
+<xsl:template match="groupOLD|itemOLD">
<xsl:param name="counter" />
<xsl:param name="doc"/>
<xsl:param name="xpath"/>
@@ -145,13 +258,18 @@
</xsl:choose>
</xsl:variable>
- <xf:group ref="{$ref}" class="from customise ({$name}, {$full_xpath})">
+ <!--
+ <xf:group ref="." class="from customise ({$name}, {$relative_xpath})">
+ -->
+ <xf:group ref="{$ref}" class="from customise ({$name}, {$relative_xpath})">
<xsl:choose>
<!-- group -->
<xsl:when test="$name != 'item'">
<xsl:apply-templates select="saxon:evaluate($full_xpath)">
<xsl:with-param name="counter" select="$position"/>
- <xsl:with-param name="xpath" select="$full_xpath"/>
+ <xsl:with-param name="xpath-todo" select="$relative_xpath"/>
+ <!--
+ -->
<xsl:with-param name="custom" select="$group"/>
<xsl:with-param name="label" select="@name"/>
</xsl:apply-templates>
@@ -159,9 +277,10 @@
<!-- item -->
<xsl:otherwise>
+ ITEM XPATH: <xsl:value-of select="$relative_xpath"/>
<xsl:apply-templates select="saxon:evaluate($full_xpath)">
<xsl:with-param name="counter" select="$position"/>
- <xsl:with-param name="xpath" select="$full_xpath"/>
+ <xsl:with-param name="xpath-todo" select="$relative_xpath"/>
<xsl:with-param name="label" select="@name"/>
</xsl:apply-templates>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
GeoNetwork-commit mailing list
GeoNetwork-commit@...
https://lists.sourceforge.net/lists/listinfo/geonetwork-commit