All, I have a difficulty to figure this one out. Basically I am interested to parse the attribute value of MsgXMLStream for msgdata element which is "New" Note: the attribute for MsgXMLStream is <msgdata>New</msgdata> Thank you for your assistance. Greatly appreciated, David Sundo -----------(I make an xml file called "test.xml") <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <rs> <z MsgID_PK='79' MsgXMLStream='<msgdata>New<msgdata>'/> </rs> ------------Test.xsl-------------------- <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <xsl:apply-templates select="//rs" /> </xsl:template> <xsl:template match="//rs"> <xsl:for-each select="z"> <xsl:for-each select="@MsgXMLStream"> <xsl:value-of select="*"/> </xsl:for-each> </xsl:for-each> </xsl:template> </xsl:stylesheet>
As you have undoubtedly found out, parsers treat the whole attribute as a text string. You are going to have to parse the string yourself. Finding the last position of "<" and first position of ">" will bracket the contents. Bill
This is not well-formed XML because you cannot have the character < in an attribute value. You will need to change it to < (While you're at it, you should also change > to > ) [ November 25, 2002: Message edited by: Ron Newman ]
Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Those cherries would go best on cherry cheesecake. Don't put those cherries on this tiny ad:
Gift giving made easy with the permaculture playing cards