Jump to content

nrawat2005

Members
  • Posts

    3
  • Joined

  • Last visited

About nrawat2005

  • Birthday 07/19/1978

Previous Fields

  • Languages
    Hindia, Enlish

Contact Methods

  • MSN
    nrawat2005
  • Skype
    nrawat2005

Profile Information

  • Location
    Delhi
  • Interests
    XSLT, XML, XQUERY, XSLFO, MarkLogic, Ant Script, DTD, Schema

nrawat2005's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Try this one with 2.0:<?xml version="1.0" ?><xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <XML> <xsl:apply-templates/> </XML></xsl:template> <xsl:template match="TAG1 | TAG2"> <LINE> <xsl:analyze-string select="text()" regex="([a-zA-Z0-9]+)("> <xsl:matching-substring> <xsl:choose> <xsl:when test=".[position() = 1]"> <TAG1><xsl:value-of select="replace(.,';','')"/></TAG1> </xsl:when> <xsl:when test=".[position() = last()]"> <TAG2><xsl:value-of select="replace(.,';','')"/></TAG2> </xsl:when> <xsl:otherwise> <TAG1><xsl:value-of select="replace(.,';','')"/></TAG1> </xsl:otherwise> </xsl:choose> </xsl:matching-substring> <xsl:non-matching-substring> <TAG2><xsl:value-of select="replace(.,';','')"/></TAG2> </xsl:non-matching-substring> </xsl:analyze-string> </LINE> </xsl:template></xsl:stylesheet>
  2. Try this one:<?xml version="1.0" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><xsl:template match="S:Body"> <xsl:variable name="firstChildName" select="child::*[1]/name()"/> <xsl:variable name="firstChildNameSpace" select="namespace-uri(child::*[1])"/> ChildName := <xsl:value-of select="$firstChildName"/> ChildNameSpace := <xsl:value-of select="$firstChildNameSpace"/></xsl:template></xsl:stylesheet>
  3. The problem is in your <xsl:param name="list" /> where you are not selecting/poining to anything and you are checking it into choose which is always returning otherwise. Here is the solution:<?xml version="1.0" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" /> <!-- start of root template --> <xsl:template match="/"> <html> <head> <title>Car Sales</title> </head> <body> <table border="1" cellpadding="5" cellspacing="5"> <tr> <!-- row 1 --> <th colspan="2">Cars List</th> </tr> <tr> <!-- row 2 --> <th>Cars:</th> <td><xsl:value-of select="count(//car)"/></td> </tr> <tr> <!-- row 3 --> <th>Quantity:</th> <td><xsl:value-of select="sum(//qty)"/></td> </tr> <tr> <!-- row 4 --> <th>Total Sale:</th> <td> <xsl:value-of select="format-number(sum(for $EachCar in cars/car return $EachCar/qty * $EachCar/price), '$#,#00.00')"/> <!-- <xsl:call-template name="calctotalsales"/>--> </td> </tr> </table> </body> </html> </xsl:template></xsl:stylesheet>
×
×
  • Create New...