Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   XML (https://www.askmehelpdesk.com/forumdisplay.php?f=448)
-   -   Trying to use XSLT to convert XML but exclude records I don't want (https://www.askmehelpdesk.com/showthread.php?t=104789)

  • Jun 27, 2007, 09:41 AM
    Christopher_amatulli
    trying to use XSLT to convert XML but exclude records i don't want
    I'm trying to figure out how to get an XML file converted using XSLT to a flat text file... I am having 2 issues with this that I am hoping someone here can help me with.

    issue 1: I want to exclude nodes based on a value of a attribute in a node. I already have a for-each running on that node, but I would like to know how to exclude them based on the value of the attribute of the node.

    issue 2: how do I insert a CRLF during the transform...
  • Sep 9, 2007, 07:11 AM
    hisham440
    I Don't Know..
    :(
  • Feb 28, 2008, 12:54 PM
    Sitwonade
    1.
    Code:

    <xsl:for-each select="//node[not(@attribute='value for which you want the node excluded')]">
      <xsl:apply-templates/>
    </xsl:for-each>

    2.
    create a variable with:
    Code:

    <xsl:variable name="CRLF">
    <xsl:text>
    </xsl:text>
    </xsl:variable>

    insert it with:
    Code:

    <xsl:value-of select="$CRLF"/>
    edit: argh... even inside the code tags it's being eaten. It should be:
    <xsl:text>ampersand pound one zero semicolon</xsl:text>
    but actually type the charcaters (not the words) and no spaces.

  • All times are GMT -7. The time now is 01:12 AM.