Käsurealt:
netstat -obf
Näeb midagi programeerjale arusaadavat, mis programmid ja kuhu võrku nad sul arvutist ühenduvad
netstat -obf 5
paneb iga 5 sekundi järel küsima
reede, 11. november 2011
reede, 4. november 2011
Named Template tegemine XSL abil
Kui on XML dokumendis samas struktuuriga tippe mida vaja teise dokumenti teisendada sobis selleks named
template kasutamine. Lähtedokumendis selline osa sees mida vaja teisendada:
<DocumentParties>
<BuyerParty context="partner">
<PartyCode>RISMA</PartyCode>
<Name>RISMA Peremarket AS</Name>
</BuyerParty>
<OrderParty context="partner">
<PartyCode>RISMA_200</PartyCode>
<Name>RISMA Peremarket AS Sukupilli KK</Name>
</OrderParty>
<SellerParty context="self">
<PartyCode>-</PartyCode>
<Name>Vensky Kaubanduse AS</Name>
</SellerParty>
<DeliveryParty context="partner">
<PartyCode>RISMA_200</PartyCode>
<Name>RISMA Peremarket AS Sukupilli KK</Name>
</DeliveryParty>
</DocumentParties>
Alamtippude sisu sama aga tipu nimi erinev. Et ei peaks iga tipu jaoks oma malli tegema võib kasutada named template.
Named XSL template väljakutsumine iseenesest selline, parameetrina annab sisse tipu sisu ja tipu nime
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/OrderParty" />
<xsl:with-param name="partynode" select="'RecipientParty'" />
</xsl:call-template>
Kogu kupatus koos tipu olemasolu kontrollidega, InvoiceParties all on need tipud mida peale teisendamist vaja saada
<InvoiceParties>
<xsl:if test="/E-Document/Document/DocumentParties/SellerParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/SellerParty" />
<xsl:with-param name="partynode" select="'SellerParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/BuyerParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/BuyerParty" />
<xsl:with-param name="partynode" select="'BuyerParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/OrderParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/OrderParty" />
<xsl:with-param name="partynode" select="'RecipientParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/DeliveryParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/DeliveryParty" />
<xsl:with-param name="partynode" select="'DeliveryParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/PayerParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/PayerParty" />
<xsl:with-param name="partynode" select="'PayerParty'" />
</xsl:call-template>
</xsl:if>
</InvoiceParties>
Named template ise
<xsl:template name="Party">
<!--node mis antakse sisse töötlemiseks-->
<xsl:param name="party" />
<!--node nimi mis parameetrina sisse antakse-->
<xsl:param name="partynode" />
<!--teeme parameetri nime järgi tipu-->
<xsl:element name="{$partynode}">
<UniqueCode>
<xsl:value-of select="$party/PartyCode"/>
</UniqueCode>
<Name>
<xsl:value-of select="$party/Name"/>
</Name>
<xsl:if test="$party/DepID">
<DepId>
<xsl:value-of select="$party/DepID"/>
</DepId>
</xsl:if>
<xsl:if test="$party/RegNum">
<RegNumber>
<xsl:value-of select="$party/RegNum"/>
</RegNumber>
</xsl:if>
<xsl:if test="$party/VATRegNum">
<VATRegNumber>
<xsl:value-of select="$party/VATRegNum"/>
</VATRegNumber>
</xsl:if>
<!--kontaktandmed-->
<xsl:apply-templates select="$party/ContactData"></xsl:apply-templates>
<!--konto info-->
<xsl:apply-templates select="$party/AccountInfo"></xsl:apply-templates>
<xsl:apply-templates select="$party/Extension"></xsl:apply-templates>
</xsl:element>
</xsl:template>
template kasutamine. Lähtedokumendis selline osa sees mida vaja teisendada:
<DocumentParties>
<BuyerParty context="partner">
<PartyCode>RISMA</PartyCode>
<Name>RISMA Peremarket AS</Name>
</BuyerParty>
<OrderParty context="partner">
<PartyCode>RISMA_200</PartyCode>
<Name>RISMA Peremarket AS Sukupilli KK</Name>
</OrderParty>
<SellerParty context="self">
<PartyCode>-</PartyCode>
<Name>Vensky Kaubanduse AS</Name>
</SellerParty>
<DeliveryParty context="partner">
<PartyCode>RISMA_200</PartyCode>
<Name>RISMA Peremarket AS Sukupilli KK</Name>
</DeliveryParty>
</DocumentParties>
Alamtippude sisu sama aga tipu nimi erinev. Et ei peaks iga tipu jaoks oma malli tegema võib kasutada named template.
Named XSL template väljakutsumine iseenesest selline, parameetrina annab sisse tipu sisu ja tipu nime
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/OrderParty" />
<xsl:with-param name="partynode" select="'RecipientParty'" />
</xsl:call-template>
Kogu kupatus koos tipu olemasolu kontrollidega, InvoiceParties all on need tipud mida peale teisendamist vaja saada
<InvoiceParties>
<xsl:if test="/E-Document/Document/DocumentParties/SellerParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/SellerParty" />
<xsl:with-param name="partynode" select="'SellerParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/BuyerParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/BuyerParty" />
<xsl:with-param name="partynode" select="'BuyerParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/OrderParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/OrderParty" />
<xsl:with-param name="partynode" select="'RecipientParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/DeliveryParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/DeliveryParty" />
<xsl:with-param name="partynode" select="'DeliveryParty'" />
</xsl:call-template>
</xsl:if>
<xsl:if test="/E-Document/Document/DocumentParties/PayerParty">
<xsl:call-template name="Party">
<xsl:with-param name="party" select="/E-Document/Document/DocumentParties/PayerParty" />
<xsl:with-param name="partynode" select="'PayerParty'" />
</xsl:call-template>
</xsl:if>
</InvoiceParties>
Named template ise
<xsl:template name="Party">
<!--node mis antakse sisse töötlemiseks-->
<xsl:param name="party" />
<!--node nimi mis parameetrina sisse antakse-->
<xsl:param name="partynode" />
<!--teeme parameetri nime järgi tipu-->
<xsl:element name="{$partynode}">
<UniqueCode>
<xsl:value-of select="$party/PartyCode"/>
</UniqueCode>
<Name>
<xsl:value-of select="$party/Name"/>
</Name>
<xsl:if test="$party/DepID">
<DepId>
<xsl:value-of select="$party/DepID"/>
</DepId>
</xsl:if>
<xsl:if test="$party/RegNum">
<RegNumber>
<xsl:value-of select="$party/RegNum"/>
</RegNumber>
</xsl:if>
<xsl:if test="$party/VATRegNum">
<VATRegNumber>
<xsl:value-of select="$party/VATRegNum"/>
</VATRegNumber>
</xsl:if>
<!--kontaktandmed-->
<xsl:apply-templates select="$party/ContactData"></xsl:apply-templates>
<!--konto info-->
<xsl:apply-templates select="$party/AccountInfo"></xsl:apply-templates>
<xsl:apply-templates select="$party/Extension"></xsl:apply-templates>
</xsl:element>
</xsl:template>
Tellimine:
Postitused (Atom)