xsl-list
[Top] [All Lists]

[xsl] FW: 2 XML Files, 1 XSLt Output to HTML

2006-10-18 06:17:40
In case anyone is working on a solution to the problem presented in my
last post, I thought it only proper to inform you that I have discovered
an answer.  It follows:
 

<xsl:template match="n1:share">

    <xsl:variable name="x" select="@item" />

    <xsl:variable name="xx" select="@loc" />

      <xsl:for-each select="document(@loc)">

            <xsl:for-each select="//*[(_at_)id=$x]"> 

                  <xsl:value-of select="."/>

            </xsl:for-each>

      </xsl:for-each>

</xsl:template>


-----Original Message-----
From: McDonald, Shaun 
Sent: Monday, October 16, 2006 6:44 PM
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: 2 XML Files, 1 XSLt Output to HTML

Hi,

I am using MSXML 3.0

XML SOURCE NAME: doc1.xml
<Oproc id="right">
        <Para>
                <bold id="ao1">text1</bold>
        </Para>
        <Para id="ao2">text2</Para>
        <Para>
                <Bold id="o3">text3</Bold>
        </Para>
        <Para id="ao4">text4</Para>
        <Para id="ao5">text5</Para>
        <Para id="ao6">text6</Para>
        <Para>
                <Caution id="ao7">text7</Caution>
        </Para>
</Oproc>

XML TARGET NAME: doc2.xml

<Oproc>
        <Para>
                <bold id="ao1">
                        <share loc="source.xml" item="ao1"/>
                </bold>
                <extRef id="getmaster" href="somedoc.html#idTitle1234"
reflocation="*" refmanual=""/>
        </Para>
        <Para id="ao2">
                <share loc="source.xml" item="ao2"/>
        </Para>
        <Para>
                <Bold id="ao3">
                        <share loc="source.xml" item="ao3"/>
                </Bold>
        </Para>
        <Para id="ao4">
                <share loc="source.xml" item="ao4"/>
        </Para>
        <Para id="ao5">
                <share loc="source.xml" item="ao5"/>
        </Para>
        <Para id="ao6">
                <share loc="source.xml" item="ao6"/>
        </Para>
        <Para>
                <Caution id="ao7">
                        <share loc="source.xml" item="ao7"/>
                </Caution>
        </Para>
</Oproc>

XSLT Version 1.0:
<xsl:template match="n1:share">
    <xsl:variable name="x" select="@item" />
    <xsl:variable name="xx" select="@loc" />
    <xsl:for-each select="document(@loc)">
      <xsl:value-of select="current()"/>
    </xsl:for-each>
 </xsl:template>

I want,
TARGET: doc2.xml:
<Oproc>
        <Para>
                <bold id="ao1">text1</bold>
                <extRef id="getmaster" href="somedoc.html#idTitle1234"
reflocation="*" refmanual=""/>
        </Para>
        <Para id="ao2">text2</Para>
        <Para>
                <Bold id="ao3">text3</Bold>
        </Para>
        <Para id="ao4">text4</Para>
        <Para id="ao5">text5</Para>
        <Para id="ao6">text6</Para>
        <Para>
                <Caution id="ao7">text7</Caution>
        </Para>
</Oproc>

What I get is,
TARGET: doc2.xml:
<Oproc>
        <Para>
                <bold
id="ao1">text1text2text3text4text5text6text7</bold>
                <extRef id="getmaster" href="somedoc.html#idTitle1234"
reflocation="*" refmanual=""/>
        </Para>
        <Para id="ao2">text1text2text3text4text5text6text7</Para>
        <Para>
                <Bold
id="ao3">text1text2text3text4text5text6text7</Bold>
        </Para>
        <Para id="ao4">text1text2text3text4text5text6text7</Para>
        <Para id="ao5">text1text2text3text4text5text6text7</Para>
        <Para id="ao6">text1text2text3text4text5text6text7</Para>
        <Para>
                <Caution
id="ao7">text1text2text3text4text5text6text7</Caution>
        </Para>
</Oproc>

I inherited these files recently.  From what I have learned, the xslt is
processing as it should.  I have not, however, been able to figure out
how to get the desired output.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>