You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Res Pons <po...@hotmail.com> on 2006/01/29 20:28:05 UTC

XML question!

Hi

Last week, thanks to your help I figured out how to pull an xml report out 
of Subversion.  The log looks basic as follows:

-----------------xml file/log----------------------------
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="rev.xsl"?>  **********# I have to 
figure out a way to echo or insert this line into each xml log from now on

<log>
<logentry
   revision="24414">
<author>steven</author>
<date>2006-01-26T10:26:07.131774Z</date>
<msg>product-build788</msg>
</logentry>
<logentry
   revision="24413">
<author>paultran</author>
<date>2006-01-26T10:17:21.297463Z</date>
<msg>Anthill: Increment build number</msg>
</logentry>
<logentry
   revision="24410">
<author>joesantini</author>
<date>2006-01-26T05:03:43.737577Z</date>
<msg>Cleaned up event data model for new advrpt process</msg>
</logentry>
.
.
.
</log>
-----------------------------

I wrote an xsl (style sheet) to create a report as follows:

--------------------.xsl file--------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

  <html>
    <body>
      <h2>Company Name</h2>
      <table border="1">

	<tr bgcolor="#9acd32">
	  <th align="left">REVISION</th>
	  <th align="left">AUTHOR</th>
	  <th align="left">DATE</th>
	  <th align="left">MSG</th>
	</tr>

	<xsl:for-each select="log/logentry">

	<tr>
	  <td><xsl:value-of select="//@revision"/></td>
	  <td><xsl:value-of select="author"/></td>
	  <td><xsl:value-of select="date"/></td>

<xsl:choose>
  <xsl:when test="msg = 'product-build788'"> ****************************
            <td bgcolor="#ff00ff">
	    <xsl:value-of select="msg"/></td>


  </xsl:when>
  <xsl:otherwise>

	  <td><xsl:value-of select="msg"/></td>


  </xsl:otherwise>
</xsl:choose>

	</tr>

	</xsl:for-each>

      </table>
    </body>
  </html>
</xsl:template></xsl:stylesheet>

-----------------------end of xsl file-----------------------

*
QUESTION: In the xsl file where I have marked it with *'s, if I look for the 
whole string exactly 'product-build788' it works but does anyone know how I 
can pass wildcards in the 'when' node, like 'product-build*' since the build 
numbers will alway change?

Thanks

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: XML question!

Posted by Phil Endecott <sp...@chezphil.org>.
Res Pons wrote:
> Last week, thanks to your help I figured out how to pull an xml report 
> out of Subversion.

> I wrote an xsl (style sheet) to create a report as follows:

..
>  <xsl:when test="msg = 'product-build788'"> 
..

> QUESTION: In the xsl file where I have marked it with *'s, if I look for 
> the whole string exactly 'product-build788' it works but does anyone 
> know how I can pass wildcards in the 'when' node, like 'product-build*' 
> since the build numbers will alway change?

I suggest xsl-list@lists.mulberrytech.com for XSLT questions.

The string functions in XSLT are described here:
http://www.w3.org/TR/xpath#section-String-Functions

One function is starts-with, which does what you want:

<xsl:when test="starts-with(msg,'product-build')">

--Phil.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org