Title: Xsl help

I think the problem may be due to the input XML. The contents of the element MOC are not simple in that you have nested comments, elements and text so when you do your Model/MOC=’MOC1’ check it is likely to fail because the contents certainly don’t equal that! Even if you ignore the sub-elements, you’ve at least got a \n after the MOC1 and some indent whitespace before the actual comment <!--method 1-->.

 

Are you able to redefine the structure of the XML? It would be a hell of a lot easier if the structure were something like this…

 

<Model>
        <!-- MOC1-->
        <MOC name=’ MOC1>
                <!--method 1-->
                <Method name=’publish’>
                        <attrName>Load</attrName>
                </Method>
        </MOC>
        <!-- MOC2-->
</Model>

It’s a lot easier to write the XSLT if the XML content is simple (i.e. don’t mix up text and elements and comments etc).

 

HTH

 

-----Original Message-----
From: Arunkumar Halebid [mailto:[EMAIL PROTECTED]
Sent:
11 January 2005 08:26
To: xalan-c-users@xml.apache.org
Subject: Xsl help

 

Hello,

* In the xsl I set the output method to text. Within the style sheet I am trying to include some string also as output, apart from node values of the input xml.

* I do not see any text output in the resulting transformation. Where am I doing a mistake?

Xsl rule is something like:

<xsl:template match="/Model/MOC">
                <xsl:choose>
                        <xsl:when test="/Model/MOC='MOC1'">Class        <xsl:value-of select="/rncModel/mngMOC"/>
                                <xsl:apply-templates select="attrName"/>
                        </xsl:when>
                </xsl:choose>                          
</xsl:template

Xml

<Model>
        <!-- MOC1-->
        <MOC>MOC1
                <!--method 1-->
                <Method>publish
                        <attrName>Load</attrName>
                </Method>
        </MOC>
        <!-- MOC2-->
</Model>

 

Reply via email to