AddExtensionObject enyesado en todo mi XML

I am using XSLT for what it is intended for i.e. mapping form 1 xml form to another.

Due to M$ lack of support for 2.0 and all the lovely functionality that comes with (case-less comparisons anyone? I hope someone lost their job for leaving that out of 1.0) plus more I am looking to using AddExtensionObject to add some functions to add the support I require. I believe this to be significantly more secure than allowing scripts to be run.

the annoyance is the plastering of the urn over all my tags. for example.

<INVAC xmlns:myColor="urn:myColor">
<MEMBO>7131</MEMBO>
<FUNDNAME>Fund00b</FUNDNAME>
</INVAC>

when I follow a modified version of http://www.15seconds.com/issue/031112.htm

I want to use the extra functionality but not have the output.......

gracias de antemano!

preguntado el 08 de noviembre de 11 a las 12:11

Hmm it seems adding the following gets rid of this instance 'exclude-result-prefixes="myColor"' -

May I suggest that reading a good book on XSLT will bolster significantly your ability to understand at least the most fundamental XSLT concepts? -

1 Respuestas

You have found the answer to your main question -- the exclude-result-prefixes atributo de xsl:stylesheet should be used to specify all namespace prefixes (a white-space-separated list) that we don't wished to be copied on literal-result elements.

Your other question is also easy to answer:

case-less comparisons anyone?

Utilizan:

 translate($s1, $vUpper, $vLower) 
=
 translate($s2, $vUpper, $vLower)

Esto evalúa a true() exactly when the two strings $s1 y $s2 ara case-insensitive-equal.

La variable $vUpper should contain all uppercase letters of the alphabet and the variable $vLower should contain all lowercaseletters of the alphabet.

Aquí hay un ejemplo completo.:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output omit-xml-declaration="yes" indent="yes"/>
 <xsl:strip-space elements="*"/>

 <xsl:param name="pNameOfElementsToDelete" select="'DeLetE'"/>

 <xsl:variable name="vUpper" select=
 "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>

 <xsl:variable name="vLower" select=
 "'abcdefghijklmnopqrstuvwxyz'"/>

 <xsl:template match="node()|@*" name="identity">
     <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
 </xsl:template>

 <xsl:template match="*[true()]">
  <xsl:if test=
  "not(
   translate(name(), $vUpper, $vLower)
  =
   translate($pNameOfElementsToDelete, $vUpper, $vLower)
   )
 ">
   <xsl:call-template name="identity"/>
  </xsl:if>
 </xsl:template>
</xsl:stylesheet>

cuando se aplica en este documento XML:

<a>
 <b>
  <Delete/>
 </b>
 <dell/>
 <c>
   <deLete/>
 </c>
</a>

this transformation produces a new XML document in which any element, whose name is equal case-insensitively to "DeLetE":

<a>
   <b/>
   <dell/>
   <c/>
</a>

respondido 08 nov., 11:17

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.