Project

Profile

Help

Weird behavior of copy-of

Added by Anonymous about 15 years ago

Legacy ID: #7393581 Legacy Poster: Eric Boisvert (denevers)

I'm not sure it's a bug, but I can't see it would be otherwise. I'm using Saxon 9.1.0.6B in cocoon 2.11 on a Win2000 box. I wrote a template that loops in all the child tags to extract their content. The problem I try to deal with is a XML document where the content can either be inline ou offline. I basically need to deal with 3 cases The resource in inline <cat:relatedResource> <cat:Resource id="x"> .. </cat:Resource> </cat:relatedResource> The resource is offline, but somewhere in the document (pointed by id in inner_ref). This is essentially done to avoid repeating the same block of XML <cat:relatedResource inner_ref="#x"/> and finally when the resource is not in the current document <cat:relatedResource outer_ref_ref="x"/> Now, I wrote a template to handle all the cases at once and gathered all the resources in a list. The template looks like this. <xsl:template name="fetchall"> <!-- the name of the tag that should contain a resource --> <xsl:param name="attname"/> <!-- the parent entity --> <xsl:param name="entity"/> <!-- loop in all the <xsl:for-each select="$entity//[local-name(.)=$attname]"> <xsl:element name="{$attname}" namespace="urn:ns:cat"> <debug><xsl:copy-of select="."/></debug> </xsl:element> </xsl:for-each> </xsl:template> Just for sake of discussion, I just report the element I found <debug><xsl:copy-of select="."/></debug> When It finds an inline document, this works fine. But when I hit a <cat:relatedResource inner_ref="#x"/> The copy-of returns nothing. And this is the strange bit: If I add a character in front of copy-of, it now works ! This works: !, copy-of returns <cat:relatedResource inner_ref="#x"/> as expected. <debug><xsl:text> </xsl:text><xsl:copy-of select="."/></debug> Any idea ?? Did I miss something obvious ?


Replies (6)

Please register to reply

RE: Weird behavior of copy-of - Added by Anonymous about 15 years ago

Legacy ID: #7393599 Legacy Poster: Michael Kay (mhkay)

Sorry, there's not enough information here to see what's going on. For example, it's not clear what the value of the parameter $entity is. Please could you supply a complete source document and stylesheet that demonstrate the problem, plus any necessary details such as parameter values; indicate the expected results and the actual results.

RE: Weird behavior of copy-of - Added by Anonymous about 15 years ago

Legacy ID: #7393633 Legacy Poster: Eric Boisvert (denevers)

This is how the template is invoked <xsl:template match="cat:Hydrogeologicunit"> <!-- more stuff happening here --> <xsl:variable name="relRes"> <xsl:call-template name="fetchall"> <xsl:with-param name="attname">relatedResource</xsl:with-param> <xsl:with-param name="entity"><xsl:copy-of select="."/></xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:apply-templates select="$relRes/cat:relatedResource"/> <!-- once I get this variable ($relRes), I apply a template to all the resource, knowning that all the references are resolved --> typical document <cat:Catalog xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cat="urn:x-ngwd:cat" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:h="http://apache.org/cocoon/request/2.0" xmlns:proc="urn:x-lcnp:proc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"> <cat:catalogMember> <cat:Hydrogeologicunit id="cat.22727"> <cat:id>22727</cat:id> <cat:owner>0</cat:owner> <cat:f_name>urn:x-ngwd:classifier:NGWD:AquiferSystem:2009:22</cat:f_name> <cat:purpose>urn:x-ngwd:purpose:compilation</cat:purpose> <cat:gu_type>AQS</cat:gu_type> <cat:obj_type>34</cat:obj_type> <cat:rank>INF</cat:rank> <cat:f_desc>Upper Thames</cat:f_desc> <cat:guid>urn:x-ngwd:classifier:NGWD:AquiferSystem:2009:22</cat:guid> <cat:observation_method2/> <cat:observation_method1>urn:x-ngwd:observationMethod:Compilation</cat:observation_method1> <cat:relatedResource> <cat:Url id="cat.23001"> <cat:online_resource>http://www.thamesriver.on.ca/groundwater/MiddlesexElgin_final_report.htm&lt;/cat:online_resource> <cat:owner>0</cat:owner> <cat:lnk_type>EX</cat:lnk_type> <cat:name>Middlesex-Elgin Groundwater Study (web site)</cat:name> <cat:obj_type>19</cat:obj_type> <cat:guid>urn:ngwd:url:23001</cat:guid> <cat:description>Web site related to the Middlesex-Elgin Groundwater Study</cat:description> <cat:id>23001</cat:id> <cat:relatedResource> <cat:Url id="cat.23000"> <cat:online_resource>http://www.thamesriver.on.ca/groundwater/Groundwater_study_report/Report/Final_Report.pdf&lt;/cat:online_resource> <cat:owner>0</cat:owner> <cat:lnk_type>EX</cat:lnk_type> <cat:name>Middlesex-Elgin Groundwater Study (02-0394 June 2004)</cat:name> <cat:obj_type>19</cat:obj_type> <cat:guid>urn:x-ngwd:report:golder:middlesex-elgin</cat:guid> <cat:description>Study by Dillon Consulting Limited in association with Golder Associated Ltd. The study was complete mainly in 2002-2003. It was directed by a Steering Committee consisting of municipal and agency representatives and project management was provided by the Upper-Thames River Conservation Authoity</cat:description> <cat:id>23000</cat:id> <cat:relatedResource inner_ref="#cat.22727"/> <cat:relatedResource inner_ref="#cat.23001"/> </cat:Url> </cat:relatedResource> <cat:relatedResource inner_ref="#cat.22727"/> </cat:Url> </cat:relatedResource> <cat:relatedResource inner_ref="#cat.23000"/> <cat:relatedResource> <cat:Url id="cat.22756"> <cat:online_resource>data/natdata.aquifersystem.html?sid=22</cat:online_resource> <cat:owner>0</cat:owner> <cat:lnk_type>IN</cat:lnk_type> <cat:name>Details on Upper Thames</cat:name> <cat:obj_type>19</cat:obj_type> <cat:guid>urn:x-ngwd:link:22756</cat:guid> <cat:description>Information collected from various sources by NRCan, including NRCan projects</cat:description> <cat:id>22756</cat:id> <cat:relatedResource inner_ref="#cat.22727"/> </cat:Url> </cat:relatedResource> </cat:Catalog> as you can see, the third resource <cat:relatedResource inner_ref="#cat.23000"/> points to a resource that is already in the document further up: <cat:Url id="cat.23000"> <cat:online_resource>http://www.thamesriver.on.ca/groundwater/Groundwater_study_report/Report/Final_Report.pdf&lt;/cat:online_resource> <cat:owner>0</cat:owner> <cat:lnk_type>EX</cat:lnk_type> <cat:name>Middlesex-Elgin Groundwater Study (02-0394 June 2004)</cat:name> <cat:obj_type>19</cat:obj_type> <!-- more --> Thanks for your help. Eric

RE: Weird behavior of copy-of - Added by Anonymous about 15 years ago

Legacy ID: #7393638 Legacy Poster: Eric Boisvert (denevers)

Sorry, while cleaning to document to remove unwanted content, I forgot to closing tags: <?xml version="1.0" encoding="UTF-8"?> <cat:Catalog xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cat="urn:x-ngwd:cat" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:h="http://apache.org/cocoon/request/2.0" xmlns:proc="urn:x-lcnp:proc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc"> <cat:catalogMember> <cat:Hydrogeologicunit id="cat.22727"> <cat:id>22727</cat:id> <cat:owner>0</cat:owner> <cat:f_name>urn:x-ngwd:classifier:NGWD:AquiferSystem:2009:22</cat:f_name> <cat:purpose>urn:x-ngwd:purpose:compilation</cat:purpose> <cat:gu_type>AQS</cat:gu_type> <cat:obj_type>34</cat:obj_type> <cat:rank>INF</cat:rank> <cat:f_desc>Upper Thames</cat:f_desc> <cat:guid>urn:x-ngwd:classifier:NGWD:AquiferSystem:2009:22</cat:guid> <cat:observation_method2/> <cat:observation_method1>urn:x-ngwd:observationMethod:Compilation</cat:observation_method1> <cat:relatedResource> <cat:Url id="cat.23001"> <cat:online_resource>http://www.thamesriver.on.ca/groundwater/MiddlesexElgin_final_report.htm&lt;/cat:online_resource> <cat:owner>0</cat:owner> <cat:lnk_type>EX</cat:lnk_type> <cat:name>Middlesex-Elgin Groundwater Study (web site)</cat:name> <cat:obj_type>19</cat:obj_type> <cat:guid>urn:ngwd:url:23001</cat:guid> <cat:description>Web site related to the Middlesex-Elgin Groundwater Study</cat:description> <cat:id>23001</cat:id> <cat:relatedResource> <cat:Url id="cat.23000"> <cat:online_resource>http://www.thamesriver.on.ca/groundwater/Groundwater_study_report/Report/Final_Report.pdf&lt;/cat:online_resource> <cat:owner>0</cat:owner> <cat:lnk_type>EX</cat:lnk_type> <cat:name>Middlesex-Elgin Groundwater Study (02-0394 June 2004)</cat:name> <cat:obj_type>19</cat:obj_type> <cat:guid>urn:x-ngwd:report:golder:middlesex-elgin</cat:guid> <cat:description>Study by Dillon Consulting Limited in association with Golder Associated Ltd. The study was complete mainly in 2002-2003. It was directed by a Steering Committee consisting of municipal and agency representatives and project management was provided by the Upper-Thames River Conservation Authoity</cat:description> <cat:id>23000</cat:id> <cat:relatedResource inner_ref="#cat.22727"/> <cat:relatedResource inner_ref="#cat.23001"/> </cat:Url> </cat:relatedResource> <cat:relatedResource inner_ref="#cat.22727"/> </cat:Url> </cat:relatedResource> <cat:relatedResource inner_ref="#cat.23000"/> <cat:relatedResource> <cat:Url id="cat.22756"> <cat:online_resource>data/natdata.aquifersystem.html?sid=22</cat:online_resource> <cat:owner>0</cat:owner> <cat:lnk_type>IN</cat:lnk_type> <cat:name>Details on Upper Thames</cat:name> <cat:obj_type>19</cat:obj_type> <cat:guid>urn:x-ngwd:link:22756</cat:guid> <cat:description>Information collected from various sources by NRCan, including NRCan projects</cat:description> <cat:id>22756</cat:id> <cat:relatedResource inner_ref="#cat.22727"/> </cat:Url> </cat:relatedResource> </cat:Hydrogeologicunit> </cat:catalogMember> </cat:Catalog>

RE: Weird behavior of copy-of - Added by Anonymous about 15 years ago

Legacy ID: #7393652 Legacy Poster: Michael Kay (mhkay)

By "complete stylesheet" I mean something that I can debug for myself, either by eye or by copying it into my own processing environment. It's very hard to debug incomplete fragments of code unless the error stares you in the face. Is there any particular reason why you are doing <xsl:with-param name="entity"><xsl:copy-of select="."/></xsl:with-param> rather than <xsl:with-param name="entity" select="."/> ? It seems unnecessary to make a copy. Saxon probably tries to optimize this by creating a "virtual copy" of the node and it's just conceivable this could lead to problems, but without runnable code I can't tell.

RE: Weird behavior of copy-of - Added by Anonymous about 15 years ago

Legacy ID: #7393690 Legacy Poster: Eric Boisvert (denevers)

I'm in the middle of coding this thing, so the stylesheet is less than optimal (not mentionning that I'm not an expert in XSLT) There are 2 stylesheets: the main one, which imports the second one (lower down) > <xsl:with-param name="entity" select="."/> I actually tried both. ================================================= <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:nfunc="urn:x-ngwd:function" xmlns:cat="urn:x-ngwd:cat" xmlns:xdoc="http://www.cgcq.rncan.gc.ca/lcnp/xdoc/1.0"> <xsl:import href="std.xslt"/> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates select="cat:Catalog/cat:catalogMember/"/> </xsl:template> <xsl:template match="cat:Hydrogeologicunit"> <xdoc:document> <xdoc:header> <xdoc:title> <xsl:choose> <xsl:when test="$locale='fr'">Système Aquifère</xsl:when> <xsl:otherwise>Aquifer System</xsl:otherwise> </xsl:choose> </xdoc:title> <!--<xdoc:toc/>--> </xdoc:header><xdoc:body> <xdoc:s1 title="{cat:f_desc}"> <xsl:choose> <xsl:when test="$locale='fr'">La catalogue BDNES possède des informations relatives à ce système aquifère. Pour consulter ces informations, suivre les liens suivant</xsl:when> <xsl:otherwise>NGWD catalog has information about this aquifer system. To get to these information, please follow the links</xsl:otherwise> </xsl:choose> <xdoc:hr/> <xdoc:s2 title="{nfunc:localise('Métadonnées','Metadata')}"> <xsl:apply-templates select="cat:documentation"/> </xdoc:s2> <xdoc:s2 title="{nfunc:localise('Ressources dans la BDNES','NGWD Resources')}"> <xsl:choose> <xsl:when test="$locale='fr'">Liste des informations disponibles dans la Base de données nationale sur les eaux souterraines.</xsl:when> <xsl:otherwise>List of information held in the National Groundwater Database</xsl:otherwise> </xsl:choose> <xsl:variable name="relRes"> <xsl:call-template name="fetchall"> <xsl:with-param name="attname">relatedResource</xsl:with-param> <xsl:with-param name="attns">urn:x-ngwd:cat</xsl:with-param> <xsl:with-param name="entity" select="."/> </xsl:call-template> </xsl:variable> <xdoc:debug><xsl:copy-of select="$relRes"/></xdoc:debug> <xdoc:table> <xsl:apply-templates select="cat:relatedResource[cat:Url/cat:lnk_type='IN']"/> </xdoc:table> </xdoc:s2> <xsl:if test="cat:relatedResource[cat:Url/cat:lnk_type='EX']"> <xdoc:s2 title="{nfunc:localise('Resources Externes','External Resources')}"> <xsl:choose> <xsl:when test="$locale='fr'">Liste des informations disponibles à l'extérieur de RNCan</xsl:when> <xsl:otherwise>List of information held outside NRCan</xsl:otherwise> </xsl:choose> <xdoc:table> <xsl:apply-templates select="cat:relatedResource[cat:Url/cat:lnk_type='EX']"/> </xdoc:table></xdoc:s2> </xsl:if> <xdoc:s2 title="{nfunc:localise('Ressources téléchargeables','Downloadable Resources')}"> <xsl:choose> <xsl:when test="$locale='fr'">Des fichiers sont disponibles en téléchargement.</xsl:when><xsl:otherwise>Files are available for download.</xsl:otherwise> </xsl:choose><xdoc:table> <xsl:call-template name="download"/> </xdoc:table> </xdoc:s2> </xdoc:s1> </xdoc:body> </xdoc:document> </xsl:template> <xsl:template match="cat:relatedResource"> <xdoc:tr><xdoc:td><xsl:apply-templates select="cat:Url"/></xdoc:td><xdoc:td><xsl:value-of select="cat:Url/cat:description"/></xdoc:td></xdoc:tr> </xsl:template> <xsl:template match="cat:relatedResource" mode="fetch"> <xdoc:s2 title="test"> <xdoc:debug><xsl:copy-of select="cat:Url"/></xdoc:debug> <xdoc:fetch src="../../{cat:Url/cat:online_resource}"/> </xdoc:s2> </xsl:template> </xsl:stylesheet> =========================================================================== and the common functions, this is where the function is =========================================================================== <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:gml="http://www.opengis.net/gml" xmlns:cat="urn:x-ngwd:cat" xmlns:nfunc="urn:x-ngwd:function" xmlns:xdoc="http://www.cgcq.rncan.gc.ca/lcnp/xdoc/1.0"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:param name="locale">fr</xsl:param> <xsl:param name="host"/> <xsl:param name="portailNGWD"/> <xsl:variable name="lbl_lessInfo"> <xsl:choose> <xsl:when test="$locale='fr'">Moins d'information</xsl:when> <xsl:otherwise>Less information</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:function name="nfunc:localise"> <xsl:param name="fr"/> <xsl:param name="en"/> <xsl:choose> <xsl:when test="$locale='fr'"> <xsl:value-of select="$fr"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$en"/> </xsl:otherwise> </xsl:choose> </xsl:function> <xsl:variable name="lbl_moreInfo"> <xsl:choose> <xsl:when test="$locale='fr'">Plus d'information</xsl:when> <xsl:otherwise>More information</xsl:otherwise> </xsl:choose> </xsl:variable> <!--<xsl:param name="locale"/>--> <xsl:template match="cat:importantNotice"> <xdoc:s2 title="Important"> <xsl:apply-templates/> </xdoc:s2> </xsl:template> <xsl:template match="cat:Inlinedocument[cat:category='DISCLAIMER']"> <xdoc:s3 title="{cat:name}"> <xsl:value-of select="cat:content"/> </xdoc:s3> </xsl:template> <!-- adds a '?' or a '&' at the end of a url, depending of the presence of absence of such character --> <xsl:template name="format_url"> <xsl:param name="url"/> <xsl:choose> <xsl:when test="ends-with($url,'?')"> <xsl:value-of select="$url"/> </xsl:when> <xsl:when test="ends-with($url,'&amp;')"> <xsl:value-of select="$url"/> </xsl:when> <xsl:otherwise> <!-- if we already have a '?', add a &, otherwise add a '?' --> <xsl:value-of select="$url"/> <xsl:choose> <xsl:when test="contains($url,'?')">&amp;</xsl:when> <xsl:otherwise>?</xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="fetch"> <xsl:param name="att"/> <xsl:choose> <xsl:when test="$att/@inner_ref"> <debug>looking for <xsl:copy-of select="$att/@inner_ref"/></debug> <xsl:variable name="id"> <xsl:value-of select="substring-after($att/@inner_ref,'#')"/> </xsl:variable> <xsl:copy-of select="//[@id=$id]"/> </xsl:when> <xsl:when test="cat:outer_ref"> <!-- dynamically select the feature, this is a guid--> <xsl:variable name="id" select="$att/@outer_ref"/> <xsl:variable name="ref" select="/cat:Catalog/cat:catalogMember/cat:Ref[@guid = id]"/> <xsl:variable name="url">/ngwds/<xsl:value-of select="$locale"/>/resource/cat/<xsl:value-of select="$att/@outer_ref"/> </xsl:variable> <!-- create a mock up feature--> <cat:Ref id="{$ref/@id}"> <cat:name><xsl:value-of select="$ref/@name"/></cat:name> <cat:guid><xsl:value-of select="$ref/@guid"/></cat:guid> </cat:Ref> </xsl:when> <xsl:otherwise> <xsl:copy-of select="$att/"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="fetchall"> <xsl:param name="attname"/> <xsl:param name="attns"/> <xsl:param name="entity"/> <original><xsl:copy-of select="$entity"/></original> <xsl:for-each select="$entity/[local-name(.)=$attname]"> <xsl:element name="{$attname}" namespace="{$attns}"> <debug><xsl:copy-of select="."/></debug> <!--<xsl:call-template name="fetch"><xsl:with-param name="att"><xsl:copy-of select="."/></xsl:with-param></xsl:call-template>--> </xsl:element> </xsl:for-each> </xsl:template> <xsl:template name="linkto"> <xsl:param name="att"/> <xsl:variable name="target"> <xsl:call-template name="fetch"> <xsl:with-param name="att" select="$att"/> </xsl:call-template> </xsl:variable> <!-- TODO, trouver une façon de passer le x-<type>, parce que l'on sais déjà le type --> <xsl:variable name="location">resource/cat/<xsl:value-of select="$target//cat:guid"/>.html</xsl:variable> <xdoc:link location="internal" href="{$location}"> <xsl:value-of select="$target//cat:name"/> </xdoc:link> </xsl:template> <xsl:template name="footer"> <xdoc:hr/><xsl:value-of select="nfunc:localise('Ajouter cet item dans votre panier','Add this item in your cart')"/><xdoc:I> (<xsl:value-of select="cat:name|cat:f_name"/>)</xdoc:I> <xdoc:cartItem><xsl:value-of select="cat:guid"/></xdoc:cartItem> </xsl:template> <xsl:template match="cat:Envelope"> <!-- inclus la carte en format image et autre informations relatives au coordonnées --> <xdoc:hr/> <xdoc:p> <xsl:variable name="mapurl">http://ngwd-bdnes.cits.nrcan.gc.ca/service/utilitaires/carteSVG/latLong2SvgMap?style=fill:red;stroke:red;stroke-width:4;%20fill-opacity:0.2;stroke-opacity:0.9&amp;amp;bbox=&lt;xsl:value-of select="translate(gml:boundedBy/gml:Envelope/gml:lowerCorner,' ',',')"/> <xsl:value-of select="translate(gml:boundedBy/gml:Envelope/gml:upperCorner,' ',',')"/> </xsl:variable> <xsl:variable name="loc"> <xsl:choose> <xsl:when test="$locale='fr'">Carte de localisation</xsl:when> <xsl:otherwise>Location map</xsl:otherwise> </xsl:choose> </xsl:variable> <xdoc:picture href="{$mapurl}" alt="loc"/> </xdoc:p> <xdoc:hr/> </xsl:template> <xsl:template match="cat:Person"> <xdoc:table> <xdoc:tr> <xdoc:td><xdoc:icon location="internal" src="icons/user.png" alt="{nfunc:localise('Personne','Person')}"/></xdoc:td><xdoc:td> <xdoc:em> <xsl:value-of select="cat:name"/> </xdoc:em> </xdoc:td> </xdoc:tr> <xdoc:tr><xdoc:td><xdoc:icon location="internal" src="icons/chart_organisation.png" alt="org"/></xdoc:td><xdoc:td><xsl:apply-templates select="cat:worksFor/"/></xdoc:td></xdoc:tr> <xdoc:tr> <xdoc:td><xdoc:td></xdoc:td> <xdoc:em> <xsl:value-of select="cat:position"/> </xdoc:em> </xdoc:td> </xdoc:tr> <xdoc:tr> <xdoc:td> <xdoc:icon location="internal" src="icons/telephone.png" alt="tel"/> </xdoc:td> <xdoc:td><xsl:value-of select="cat:phone"/></xdoc:td> </xdoc:tr> <xdoc:tr> <xdoc:td> <xdoc:icon location="internal" src="icons/email.png" alt="tel"/> </xdoc:td> <xdoc:td><xdoc:link href="mailto:{cat:email}"><xsl:value-of select="cat:email"/></xdoc:link></xdoc:td> </xdoc:tr> </xdoc:table> </xsl:template> <xsl:template match="cat:Organisation"> <xdoc:link location="external" href="{cat:url}"><xsl:value-of select="cat:name"/></xdoc:link><xdoc:hr/> <xdoc:icon location="internal" src="icons/house.png" alt="fax"/><xsl:text> </xsl:text><xsl:value-of select="nfunc:localise('Adresse','Address')"/>:<xsl:value-of select="cat:address"/><xdoc:br/> <xdoc:icon location="internal" src="icons/page_white.png" alt="fax"/><xsl:text> </xsl:text>Fax:<xsl:value-of select="cat:fax"/><xdoc:br/> </xsl:template> <xsl:template match="cat:Url"> <xsl:variable name="inex"><xsl:choose> <xsl:when test="cat:lnk_type = 'IN'">internal</xsl:when><xsl:otherwise>external</xsl:otherwise></xsl:choose></xsl:variable> <xdoc:link location="{$inex}" href="{cat:online_resource}"><xsl:value-of select="cat:name"/></xdoc:link> </xsl:template> <xsl:template match="cat:documentation"> <!-- should be a metadata or a child of metadata --> <xdoc:icon location="internal" src="icons/tag_blue.png"/><xsl:text> </xsl:text><xdoc:link location="internal" href="{$portailNGWD}{$locale}/metadata/{.//cat:refid}.html"><xsl:value-of select="nfunc:localise('Métadonnée','Metadata')"/></xdoc:link> </xsl:template> <xsl:template name="download"> <xdoc:table> <xsl:for-each select="cat:download/cat:Archivedocument"> <xsl:variable name="filename"><xsl:value-of select="cat:filename"/></xsl:variable> <xdoc:tr> <xsl:choose> <xsl:when test="string-length($filename) = 0"> <xdoc:td><xdoc:icon location="internal" src="icons/package.png"/></xdoc:td> <xdoc:td> <xdoc:link location="internal" href="{$portailNGWD}{$locale}/downloadmanager/dataset.html?package={cat:pathproxy}"><xsl:value-of select="cat:name"/></xdoc:link></xdoc:td> </xsl:when> <xsl:otherwise> <xdoc:td><xdoc:icon location="internal" src="icons/page_world.png"/></xdoc:td> <xdoc:td><xdoc:resources> <xdoc:app>zipIt</xdoc:app> <xdoc:label></xdoc:label> <xdoc:resId><xsl:value-of select="cat:guid"/></xdoc:resId> </xdoc:resources></xdoc:td> </xsl:otherwise> </xsl:choose> <xdoc:td><xsl:value-of select="cat:description"/></xdoc:td> <xdoc:td><xdoc:link location="internal" href="{$portailNGWD}{$locale}/resource/cat/{cat:guid}.html"><xdoc:icon location="internal" src="icons/help.png"/> </xdoc:link></xdoc:td> <xdoc:td><xdoc:cartItem><xsl:value-of select="cat:guid"/></xdoc:cartItem></xdoc:td> </xdoc:tr> </xsl:for-each> </xdoc:table> </xsl:template> </xsl:stylesheet> ========================================================================================

RE: Weird behavior of copy-of - Added by Anonymous about 15 years ago

Legacy ID: #7393752 Legacy Poster: Eric Boisvert (denevers)

I dug further and it looks like the problem was not in saxon, but in the debugging tool I've been using. For some reason, it omitted to output empty tags !. I tested in another environment and the tag shows indeed. All my appologies for not testing all options Thanks for you help Eric

    (1-6/6)

    Please register to reply