xml - Passing copy-of to a function? -


i need select copy of following nodes:

<xsl:copy-of select="node1/node2/*" /> 

and need pass value of copy function processnodes receives string input parameter , return string processing, , write result as:

<data>    result of function </data> 

i thought can put

<data>     <xsl:copy-of select="myfunction:processnodes(node1/node2/*)" /> </data> 

but incorrect.

may know correct syntax this?

ps: document xml like:

<node1>     <node2>        <html>           <body>               <p>my first paragraph.</p>               <p>my 2nd paragraph. , paragrah                  has 2 lines.</p>           </body>        </html>      </node2> </node1> 

and need write them

<data>     first paragraph.     2nd paragraph. , paragrah has 2 lines. </data> 

note 2 lines in 2nd paragraph merged 1 line.

that why need copy-of tags <p> can preserved , can arrangement of paragraph want.

i not know if there easier.

do not pass sequence of nodes. pass parent element use inside function scope children.

<xsl:value-of select="myfunction:processnodes(node1/node2)" /> 

after having added "ps", intent still unclear (to me @ least). result want can achieved without cutom function. example:

<xsl:stylesheet version="2.0"      xmlns:xsl="http://www.w3.org/1999/xsl/transform">      <xsl:output method="xml" indent="yes"/>     <xsl:strip-space elements="*"/>      <xsl:template match="/*/*/*/*">         <data>             <xsl:apply-templates select="p"/>         </data>     </xsl:template>      <xsl:template match="p">         <xsl:value-of select="concat(normalize-space(.),'&#xa;')"/>     </xsl:template>  </xsl:stylesheet> 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -