共用方式為


Strings strings strings strings...

I was just talking to someone internally about this, and thought I should post it: All of the values that the Data View Web Part get back are strings. Basically, we just take the values in the XML and display them as they are (in some cases, like with SharePoint data, we can be a little bit smart about how to format these strings, but still, we get it wrong sometimes).

So, what does that mean to you? It means that if you want your XML data to look a certain way, you need to use either FrontPage's formatting tools, or hand-code some XSLT.

In some cases, hand-coding will be the only way to go.

So in the how to section, I'm going to start posting quick XSLT code snippets to help with some formatting issues.

For example, <xsl:value-of select=”substring-before(@URL, ', ')”/> grabs you everything before the comma in a URL field type.

So if you have a code snippet to share or if you have a question you think might be a Top 10, share it. I only have about five or six to post for now.

-John

Comments

  • Anonymous
    April 29, 2004
    Being an old ASP coder since the NT4 Option Pack beta I have avoided XSL (and FP for that matter) like the plague. That was until wss came out and I was forced to use FrontPage. Now I use FP more than any other app (well, Outlook is still number 1). When I show ASP.Net developers the Data View Web Part (DVWP, hey, I may have created a new acronym) they are blown away. The side effect of the DVWP is that you soon find out that under the covers it is all XSL so I have had to learn it.
    My current favorite is the concat function.
    If I want to append something to the URI I can do it like this
    "><xsl:value-of select="concat(@FileRef, '?menu=', @Menu)"/&gt;
  • Anonymous
    April 30, 2004
    The comment has been removed
  • Anonymous
    May 03, 2004
    Hi Jim,

    I am not seeing the TinyURL part of the above linked discussion, but I don't think I need to.

    You should just not have to use the AutoHyperLink function.

    Try this:

    xsl:value-of disable-output-escaping="yes" select="@Comment&quot;

    Does that not work for you?

    -John
  • Anonymous
    May 06, 2004
    Apologies to both Jim and John. I already incorporated the comments into the main wss FAQ item (and converted the tinyurl links Jim loves to full links while I was at it).