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

RE: Using id() when id and idref are in 2 different fi

Subject: RE: Using id() when id and idref are in 2 different files
From: "Chris Matchett" <matchett79@xxxxxxxxxxx>
Date: Mon, 13 Dec 2004 12:20:22 -0000
xsl idref
Thanks! Now it works!
> 
> If your documents are
> <xsl:value-of name="doc1" select="document('1.xml')"/>

I guess this should have been xsl:variable rather than xsl:value-of?

> <xsl:variable name="x" select="@ref"/>
> <xsl:for-each select="$doc1|$doc2|$doc3">
>   <xsl:apply-templates select="id($x)"/>
> </xsl:for-each>

I have only 1 document but I'd imagine that the purpose of xsl:for-each here
is to set the context node?

Now I have the values all bunched together and unformatted. So I changed
apply-templates to value-of and tried to use another for-each loop for each
value but it doesn't seem to like me nesting it in the other loop. I get
errors about the otherwise statement they are all inside. XML Parsing Error:
mismatched tag. Expected: </xsl:otherwise>.

<xsl:template match="move">
<p>
  <em>
    <xsl:choose>
      <xsl:when test="(@type = 'Exit') and not (@who)">
        Exeunt
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="@type" />: 
        <xsl:variable name="cast" select="document('front.xml')" />
        <xsl:variable name="who" select="@who" />
        <xsl:for-each select="$cast">
          <xsl:for-each select="id($who)" />
            <xsl:value-of select="id($who)" />, 
          </xsl:for-each>
        </xsl:for-each>
      </xsl:otherwise>
    </xsl:choose>
  </em>
</p>
</xsl:template>

Have I lost the plot sat at home with my cold and newbie brain? Or is there
an alternative to setting the context instead of for-each? I guess this has
taken up a lot of emails today for everyone and if that is the case please
feel free to point me with a suggested search term to use with the archives
or Google.

Many thanks to everyone that has replied so far.

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.