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

Importing ns from xml to xslt (?!) ...

Subject: Importing ns from xml to xslt (?!) ...
From: Kurt George Gjerde <kurt.gjerde@xxxxxxxxxxxxxxxxx>
Date: Wed, 8 May 2002 18:30:34 +0200 (MET DST)
xsl xmlns my
Hi,

I've just starting fiddling around with xforms in xslt.

My current problem is that the form elements (input, etc) should contain
xpath ref's to elements in xforms:model/instance. The XSL uses evaluate()
to do this so that's not a problem (except it being xslt off-spec).

BUT, these ref's will most often be namespaced. And, since the idea is to
make a general xsl to be used with all xforms, the xsl would not be aware
of these namespaces resulting in the evaluate() not being able to perform.

See the working example xml/xsl below. The current  xmlns:my=...  in
xsl:stylesheet  should not be there. Is this possible in some way?


Thanks,
-Kurt.


---XML---

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="xforms.xsl" type="text/xsl"?>

<thing
  xmlns:xforms="http://www.w3.org/2002/01/xforms"
  xmlns:my="http://my.com"
>

  <xforms:model>
    <xforms:instance>
      <project xmlns="http://my.com">
        <title>The Dummy Project</title>
        <leader>
          <firstname>Jane</firstname>
          <lastname>Eyre</lastname>
        </leader>
      </project>
    </xforms:instance>
  </xforms:model>

  <group xmlns="http://www.w3.org/2002/01/xforms">
    <input ref="my:title">
      <caption>Project</caption>
    </input>
    <input ref="my:leader/my:firstname">
      <caption>First name</caption>
    </input>
    <input ref="my:leader/my:lastname">
      <caption>Last name</caption>
    </input>
  </group>

</thing>



---XSL---

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="1.0"
  xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon"
  xmlns:xforms="http://www.w3.org/2002/01/xforms"

  xmlns:my="http://my.com"

>

  <xsl:output method="html" encoding="ISO-8859-1"/>

  <xsl:template match="thing">
    <H1>xforms-xslt // test 1</H1>
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="xforms:group//xforms:input">
    <small><xsl:value-of select="xforms:caption"/></small><br/>
    <input name="{@ref}"
      value="{
        saxon:evaluate(
          concat('//xforms:model/xforms:instance//',@ref)
        )
      }"
    />
    <br/><br/>
  </xsl:template>

  <xsl:template match="xforms:model"/>

</xsl:stylesheet>















__________
kurt george gjerde <kurt.gjerde@xxxxxxxxxxxx>
intermedia uib, university of bergen






 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.