Note that there are some explanatory texts on larger screens.

plurals
  1. POcan template match process params whose value is xml tag
    text
    copied!<p>The XSL below will extract "The Role of Magnetic Focus". but now i have to modify the xsl such that the input tags has to be passed as args.</p> <p><strong>Input XML:</strong></p> <pre><code>&lt;w:document&gt; &lt;w:body&gt; &lt;w:p&gt; &lt;w:pPr&gt; &lt;w:pStyle w:val="articletitle"/&gt; &lt;/w:pPr&gt; &lt;w:r&gt; &lt;w:t&gt;The Role of Magnetic Focus&lt;/w:t&gt; &lt;/w:r&gt; &lt;/w:p&gt; &lt;w:p&gt; &lt;w:pPr&gt; &lt;w:pStyle w:val="paragraph"/&gt; &lt;/w:pPr&gt; &lt;w:r&gt; &lt;w:t&gt;All is well&lt;/w:t&gt; &lt;/w:r&gt; &lt;/w:p&gt; &lt;/w:body&gt; &lt;/w:document&gt; </code></pre> <p><strong>XSL</strong>:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" &gt; &lt;xsl:output method="text"/&gt; &lt;xsl:template match="w:p"/&gt; &lt;xsl:template match="w:p[w:pPr/w:pStyle/@w:val[matches(., concat('^(articletitle)$'),'i')]]"&gt; &lt;xsl:value-of select="."/&gt;&lt;xsl:text&gt; &lt;/xsl:text&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>I modified the above xsl as below, but i am not able to obtain the required output </p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" &gt; &lt;xsl:param name="styleName" select="articletitle"/&gt; &lt;xsl:param name="para" select="w:p"/&gt; &lt;xsl:param name="parastyle" select="w:pPr/w:pStyle/@w:val"/&gt; &lt;xsl:output method="text"/&gt; &lt;xsl:template match="@* | node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@* | node()"/&gt; &lt;xsl:choose&gt; &lt;xsl:when test="name() = $para"&gt; &lt;xsl:message&gt;&lt;xsl:value-of select="name()"/&gt;&lt;/xsl:message&gt; &lt;xsl:value-of select="name()"/&gt; &lt;/xsl:when&gt; &lt;/xsl:choose&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Please help.....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload