[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Urgent:Concat values of two eleemnt Nodes

Subject: Re: Urgent:Concat values of two eleemnt Nodes
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Wed, 31 Oct 2001 04:15:16 +0100
x9
Hello Kim,

1. Who should understand this XML-file? ;-) Give a hint what 'mdc', 'mfh'
and so on are.

> 1.  Get the value of the <mff> node element display in the output right
> after the value of <mst> or <cbt> node?  Use the ../../ path?

2. Yes, this is possible. Or /mdc/mff. If there are more than one in a file
(I don't know whether ...), following::mff[1] (the first following mff in
document order) will be more helpful I assume. But if there is only 1
/mdc/mff should be the fastest way.

> 2. concat the <r> value to <mt> value?

You want to create text, so you don't need to concat, write the 2 values in
one row or however.

<xsl:value-of select="r"/><xsl:value-of select="mt"/>

the concat():

<xsl:value-of select="concat(r,mt)"/>

> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>  <xsl:output method="xml" indent="yes"/>

When you want to create text, why you don't switch the output-method to
text?

<xsl:output method="text"/>

>  <xsl:preserve-space elements="&#x9;"/>

What's that? With <xsl:preserve-space> you tell the elements written
space-delimited in elements="...." to hold there spaces. I think you don't
need it here.

>  <xsl:template match="mfh">
>   <xsl:apply-templates select="ffv"/>
>   <xsl:apply-templates select="cbt"/>
>  </xsl:template>
>  <xsl:template match="ffv">
> File Version                          : <xsl:text/>
>   <xsl:value-of select="."/>
>  </xsl:template>
>  <xsl:template match="cbt">
> Collection Begin Time           : <xsl:text/>
>   <xsl:value-of select="."/>
>
>
&#xA;======================================================================
>
>     </xsl:template>

Why you use empty <xsl:text>-nodes? It's better to write the complete 'File
Version      :' and all text-nodes in a <xsl:text>

I don't get your 'current output'. After formatting your XSL to the
following I get this output:

File Version                    : 1
Collection Begin Time           : 20010725191502
======================================================================
-   networkInd : FIXME_PUT_IN_ATTR_VALUE[n]
-   signallingPointCode : FIXME_PUT_IN_ATTR_VALUE[n]
-   testPatternSltm : FIXME_PUT_IN_ATTR_VALUE[n]
End of Granularity Period       : 20010725191502
======================================================================
-   networkInd : FIXME_PUT_IN_ATTR_VALUE[n]
-   signallingPointCode : FIXME_PUT_IN_ATTR_VALUE[n]
-   testPatternSltm : FIXME_PUT_IN_ATTR_VALUE[n]
End of Granularity Period       : 20010725191502
======================================================================
End of Overall Collection       : 20010725191548

XSL:

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
    <xsl:output method="text"/>

    <xsl:template match="mdc">
        <xsl:apply-templates select="mfh"/>
        <xsl:apply-templates select="md"/>
        <xsl:apply-templates select="mff"/>
    </xsl:template>

    <xsl:template match="mfh">
        <xsl:apply-templates select="ffv"/>
        <xsl:apply-templates select="cbt"/>
    </xsl:template>

    <xsl:template match="ffv">
        <xsl:text>File Version                    : </xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>&#xA;</xsl:text>
    </xsl:template>

    <xsl:template match="cbt">
        <xsl:text>Collection Begin Time           : </xsl:text>
        <xsl:value-of select="."/>

<xsl:text>&#xA;=============================================================
=========</xsl:text>
        <xsl:text>&#xA;</xsl:text>
    </xsl:template>


    <xsl:template match="md">
        <xsl:apply-templates select="mi"/>
    </xsl:template>

    <xsl:template match="mi">
        <xsl:apply-templates select="mt"/>
        <xsl:apply-templates select="mst"/>
    </xsl:template>

    <xsl:template match="mst">
        <xsl:text>End of Granularity Period       : </xsl:text>
        <xsl:value-of select="."/>

<xsl:text>&#xA;=============================================================
=========</xsl:text>
        <xsl:text>&#xA;</xsl:text>
    </xsl:template>

    <xsl:template match="mv">
        <xsl:apply-templates select="moid"/>
        <xsl:apply-templates select="r"/>
    </xsl:template>

    <xsl:template match="moid">
        <xsl:text>MO Instance                    : </xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>&#xA;</xsl:text>
    </xsl:template>

    <xsl:template match="r">

<xsl:text>&#x9;&#x9;&#x9;ATTR_VALUE[n]&#x9;&#x9;&#x9;:&#x9;</xsl:text>
        <xsl:value-of select="."/>
        <xsl:if test="position()=last()">-&#xA;</xsl:if>
        <xsl:text>&#xA;</xsl:text>
    </xsl:template>

    <xsl:template match="mt">
        <xsl:text>-&#x9;&#x9;&#x9;</xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>&#x9;:&#x9;FIXME_PUT_IN_ATTR_VALUE[n]</xsl:text>
        <xsl:text>&#xA;</xsl:text>
    </xsl:template>


    <xsl:template match="mff">
        <xsl:text>End of Overall Collection       : </xsl:text>
        <xsl:value-of select="."/>
        <xsl:text>&#xA;</xsl:text>
    </xsl:template>
</xsl:stylesheet>

Try to tell us more exactly what you want. I'm sure we can help you.

Joerg


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.